I have a Popup menu associated with a Rich Edit window. The popup menu
contains one MenuItem.
That MenuItem has one event handler associated with the OnClick event.
This event handler
highlights the line in the Rich Edit window.
The user left clicks on a line. The user then right clicks in the Rich
Edit window. A menu pops up.
The user selects the only option to highlight the line. The line is
then highlighted, but the menu doesn't
go away unless the user clicks on the menu or somewhere else.
How do I close the Popup Menu so the user doesn't have to click
elsewhere?
I want the menu to go away after the line is highlighted.
-- Thomas
Gambit
"Thomas Matthews" <thomas....@pb.com> wrote in message
news:3C4712BF...@pb.com...
SetForegroundWindow(Handle);
// display menu
SendMessage(Handle, WM_NULL, 0, 0);
Since you're working with an AutoPopup menu, you could call
SetForegroundWindow() in the OnPopup event, and SendMessage() in the OnClick
handler.
The other alternative is to try simply sending a WM_CANCELMODE message in
the OnClick handler:
SendMessage(Handle, WM_CANCELMODE, 0, 0);
Both of these are untested. AutoPopup menus always work fine for me. I
only resort to the SFW()/WM_NULL trick for menus displayed manually via
Popup()
Gambit
"Thomas Matthews" <thomas....@pb.com> wrote in message
news:3C48399F...@pb.com...
Would you please tell me why WM_NULL works?
Gambit
"robin" <ro...@mdi.ca> wrote in message news:3c487aa4$1_1@dnews...