Windows >
Software Development for Windows Client Forums
>
Windows SideShow Development
>
Menu selection events fired twice for one selection
Menu selection events fired twice for one selection
- 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
- 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- Marked As Answer byDan PolivyMSFT, ModeratorTuesday, September 22, 2009 4:11 PM
All Replies
- 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) - 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.
- 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) - 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 - Craig,
Are you using the latest version of the Device Simulator (v3.0)? Is this 100% repro on all menus or certain menus?
Dan - 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 - 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 - 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 - Unfortunately not; it is just available as source code only. Can you reproduce it just by creating a new gadget using the template?
- 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 - Craig,
You can send us a note at sshowext _at_ microsoft.com and we can take a look.
Thanks,
Dan - 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- Marked As Answer byDan PolivyMSFT, ModeratorTuesday, September 22, 2009 4:11 PM


