Home > Archive > MS SQL Server ODBC > August 2005 > How determine how a Context menu was closed?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How determine how a Context menu was closed?
Al Koch

2005-08-27, 1:23 pm

Hello,

I need to be able to determine the method used to close a Context menu. It
appears that there are three possibilities: 1) a menu selection was clicked,
2) the User clicked outside the menu or 3) the User hit ESC. I need to
determine if the menu closed due to either of the last two possiibilities.
(This may seem like a mysterious requirement but the popup of the Context
Menu is triggered by a specific event in a Frame. If a menu selection is
made then certain actions are taken but if the User "cancels" by items #2 or
#3 I need to take a different action to "clean up").

TrackPopupMenu() blocks and does not return until the menu has been closed,
but this happens before the handler for a selected menu item (if an item was
choosen) is called. That means that upon return from TrackPopupMenu() I
can't tell yet if a menu item was selected (since, if a handler is going to
fire, it hasn't yet fired). WM_EXITMENULOOP is also sent when the menu
closes but I can't depend that this will always been sent/processed *AFTER*
any possible menu selection message so I hacve the same problem with using
that.

So the question boils down to how can I, upon return from WM_EXITMENULOOP(),
detect how the menu was closed? I guess I could "go to sleep" for one
second upon return to give any possible menu selection message time to hit
its handler but that seems like a big kludge and I'm not sure how long I'd
have to wait to be sure.

Thanks.

Al
AlKoch@MyRealBoxREMO
VEALLTHESECHARS.com



Al Koch

2005-08-27, 1:23 pm

Sorry - please ignore - obviously sent to wrong group!

Al


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com