On approximately 1/29/2004 2:30 PM, came the following characters from
the keyboard of Johan Lindstrom:
At 16:25 2004-01-29, Peter Eisengrein wrote:

I had a script whose NotifyIcon worked fine under version 0.0.580 of Win32::GUI that no longer works since I upgraded to 0.0.670. It gets the event and shows the appropriate menu when you click on the NI but does not get anything when you click on one of the items on the menu.


I had a similar problem that Glenn helped me with on this list. I solved it by adding a call to DoEvents after the call to TrackPopupMenu. My theory is that the menu object was kept in scope in .558, but not in .670. So the call to DoEvents gets the event handled before the menu is destroyed.

I'm glad you recognized the symptoms on this one were the same, Johan. Since they were not my symptoms, I guess it didn't click for me. But indeed, it seems that scoping is the culprit. I couldn't say what is different about the versions that causes the scoping difference, but clearly something is.

So I will augment your solution suggestion with my other one, which is to keep the menu in scope, in your own code, by promoting the pointer returned from MakeMenu to some more global context. As I recall, your very dynmaic menus made the call to DoEvents an easier solution for you, but for programs with more static menus, keeping the pointer around is probably the more appropriate solution.

--
Glenn -- http://nevcal.com/
===========================
The best part about procrastination is that you are never bored,
because you have all kinds of things that you should be doing.


Reply via email to