How detect and cancel active popup menu |
|
Hi,
My app can asynchronously switch state. When this happens I need to close any popup menu that's active (may be in the main window, may be in a child window). This leads to 2 questions:
-1- how can I find if there's a popup menu active (and get a handle to it)
-2- how can I cancel this popup menu?
Thanks in advance,
Gerrit Beuze
|
Re: How detect and cancel active popup menu |
|
> Call the Win32 API EndMenu() function, or send a WM_CANCELMODE message to
> the menu's owner window. If you are using a VCL menu, the owner window is
> specified in the Window property of the global "PopupList" object of the
> Vcl.Menus unit.
Thanks, it works indeed for VCL based popups, Unfortunately I'm using TB2/TBX based menus and that does not work.
Just incase anyone else is interested: what does work is
H := GetCapture();
if (H <> 0) then
SendMessage(H, WM_CANCELMODE, 0, 0);
This will cancel all controls (in this app) that had the capture, but in my case that is OK,
Gerrit Beuze
|
Re: How detect and cancel active popup menu |
|
Gerrit wrote:
> -1- how can I find if there's a popup menu active (and get a
> handle to it)
You don't, nor do you need it.
> -2- how can I cancel this popup menu?
Call the Win32 API EndMenu() function, or send a WM_CANCELMODE message to
the menu's owner window. If you are using a VCL menu, the owner window is
specified in the Window property of the global "PopupList" object of the
Vcl.Menus unit.
--
Remy Lebeau (TeamB)
|