Hi,
Here's another one, how can I (if possible) detect that a right click context menu is showing / exists?
I have several controls close to each other an I am monitoring which control the mouse is over, however the context menu can "spill" over another control.
In the above case, when you move the mouse across the context menu to select an option the mouse is actually over a different control.
The bottom line is that the monitoring of which control I am over is done in a timer and I would simply like to stop the timer when the context menu is showing & restart the timer when it has gone.
Any ideas please?
Andy.
What comes to mind is this scheme:
you need to have a global flag to enable/disable the timer
So, in your menu where you activate the context menu set the global flag and disable the timer
Then, in each of the context menu item handlers(which will close the context menu) reset the global flag allowing the timer to be restarted again.
you may want to to consider a slight delay in resetting the flag so you don't immediately select the control under the context menu option you selected.
Thanks Larry,
That gave me all sorts of ideas and in the end the answer was quite simple.
I have a global UINT called hPopup (handle for the context menu).
The main window (w1) is sub classed so I was able to add in its sub class handler under the case WM_LBUTTONDOWN just hPopup = 0
The context menu can call cases 101 & 102 in the window's main handler, so when any of these are selected before the end of each of the case's code I have
STOPTIMER w1
Do whatever...
hPopup = 0. (set hPopup back to zero)
STARTTIMER w1,TimerSpeed
Finally in my timer I have:
IF hPopup (context menu is showing)....
RETURN 0
ENDIF
Nice one Larry!
Andy.
:)