about popup menus

when you create a popup menu (right click on a window), and immediately do a left click outside that menu (in the parent frame) is there a way to make (from inside the wx.menu class) that click not to propagate to the parent frame work?

heres a code sample [1]. to test what am doing do a right click on the frame (the popup menu will show) and then do a left click in the frame (outside the popup menu). you will see that that event will be reported to the parent frame. I want that mouse event to close the popup menu and nothing more..

I know that could be easily done in the parent frame using a "flag" variable that recognize if the left click is done after creating the popup menu, but am wondering if thats possible from withing the wx.Menu class..

I think is more intuitive that way

[1] http://pastebin.com/3FjWenGN

No, there is nothing built-in to deal with this issue. It is also different based on what platform you are on... I usually use the flag approach to deal with this issue, with a short timer or a CallAfter to reset the flag in case the mouse event wasn't in the window that is catching the mouse events (IOW, for cases where there won't be an event that needs to be ignored.)

···

On 4/23/11 6:20 PM, PythonJourney wrote:

when you create a popup menu (right click on a window), and immediately
do a left click outside that menu (in the parent frame) is there a way
to make (from inside the wx.menu class) that click not to propagate to
the parent frame work?

heres a code sample [1]. to test what am doing do a right click on the
frame (the popup menu will show) and then do a left click in the frame
(outside the popup menu). you will see that that event will be reported
to the parent frame. I want that mouse event to close the popup menu and
nothing more..

I know that could be easily done in the parent frame using a "flag"
variable that recognize if the left click is done after creating the
popup menu, but am wondering if thats possible from withing the wx.Menu
class..

I think is more intuitive that way

--
Robin Dunn
Software Craftsman

Again, thank you very much for the reply Robin!...

El 25/04/2011 12:59 p.m., Robin Dunn escribi�:

···

On 4/23/11 6:20 PM, PythonJourney wrote:

when you create a popup menu (right click on a window), and immediately
do a left click outside that menu (in the parent frame) is there a way
to make (from inside the wx.menu class) that click not to propagate to
the parent frame work?

heres a code sample [1]. to test what am doing do a right click on the
frame (the popup menu will show) and then do a left click in the frame
(outside the popup menu). you will see that that event will be reported
to the parent frame. I want that mouse event to close the popup menu and
nothing more..

I know that could be easily done in the parent frame using a "flag"
variable that recognize if the left click is done after creating the
popup menu, but am wondering if thats possible from withing the wx.Menu
class..

I think is more intuitive that way

No, there is nothing built-in to deal with this issue. It is also different based on what platform you are on... I usually use the flag approach to deal with this issue, with a short timer or a CallAfter to reset the flag in case the mouse event wasn't in the window that is catching the mouse events (IOW, for cases where there won't be an event that needs to be ignored.)