Windows > Software Development for Windows Client Forums > Windows SideShow Development > Menu selection events fired twice for one selection
Ask a questionAsk a question
 

AnswerMenu selection events fired twice for one selection

  • Friday, June 12, 2009 6:32 PMcncb2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I seem to get MenuSelect fired twice for one menu selection.  It is intermittent but is a problem for my gadget when it happens.  This is also the case for ContextMenuSelect.  This is on Vista with the Device Simulator if it makes a difference.  Is there something I can do to avoid this? Thanks.

Answers

  • Tuesday, September 22, 2009 4:11 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Just to close down this thread, we have identified an issue with the Simulator running on certain PCs, however this issue should not affect any real devices.

    Dan

All Replies

  • Sunday, June 14, 2009 9:42 AMJames Woodall Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi there,

    sometimes when this happens it is because the gadget is running more than once and therefore each instance receives the event.  Can you confirm that only 1 instance of your exe is running?

    Regards,
    -james
    -james (Ikanos Consulting)
  • Sunday, June 14, 2009 2:19 PMcncb2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply.  Yes, I see my gadget exe only once in Task Manager and I have used the Visual Studio template which I believe checks to make sure another instance is not already running on startup.
  • Sunday, June 14, 2009 8:56 PMJames Woodall Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok, thats good!

    The other alternative is that you are subscribing to the MenuSelect event more than once.  Put a breakpoint everywhere where the event subscription is and see how often it is fired.

    Hope this helps,
    -james (Ikanos Consulting)
  • Monday, June 15, 2009 12:15 AMcncb2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, but it only connects to the event once. Unfortunately there is nothing in the event for me to distinguish when it is being fired for the second time (and it does not always fire twice either). Any other ideas?
    -Craig
  • Monday, June 15, 2009 6:08 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Craig,

    Are you using the latest version of the Device Simulator (v3.0)?  Is this 100% repro on all menus or certain menus?

    Dan
  • Monday, June 15, 2009 8:06 PMcncb2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dan,

    Yes,  I'm using the newest Device Simulator v 3.0.  It seems pretty reproducible and happens with context menus as well.  I have a workaround for my regular menus where I can keep track of the current "page" and not respond when the target page is the same as the current page (which indicates that it is going through for the second time).  But I don't think this will work for context menus as I will want to be able to use the context menu multiple times on the same menu page.
    -Craig
  • Tuesday, June 16, 2009 3:57 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Craig,

    Can you give it a shot with the Windows SideShow Bitmap device (http://www.codeplex.com/sideshowbitmap)?  That should at least help narrow it down to an API/gadget issue or a device issue.

    Dan
  • Tuesday, June 16, 2009 5:27 PMcncb2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Is there a built version of the Bitmap simulator (.exe)?  I am not in a position to build it (I'm just using C# at the moment).

    -Craig
  • Thursday, June 18, 2009 3:42 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Unfortunately not; it is just available as source code only.  Can you reproduce it just by creating a new gadget using the template?
  • Friday, June 19, 2009 2:30 AMcncb2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dan,

    I made a simple example from the template that shows the problem.  Strangely, when I run it from the debugger it seems to be intermittent (only sometimes fires the event twice) but seems to always do it when I run it outside the debugger.  I can email the project and more details to you if you give me an address.  Thanks.
    -Craig
  • Monday, June 22, 2009 8:53 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Craig,

    You can send us a note at sshowext _at_ microsoft.com and we can take a look.

    Thanks,
    Dan
  • Tuesday, September 22, 2009 4:11 PMDan PolivyMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Just to close down this thread, we have identified an issue with the Simulator running on certain PCs, however this issue should not affect any real devices.

    Dan