Propagating event to controls on a popup window

Jeffrey Barish jeff_barish at earthlink.net
Wed Feb 14 11:51:29 PST 2007


Robin Dunn wrote:

> Because calling ProcessEvent only sends the wxEvent to the wx classes.
> It does not cause it to get turned back into the native event and
> forwarded on to the native widget as if it was originally sent there.
> The only way to do that is to call the native API that does it, such as
> SendMessage on Windows.

If I can't distribute an event to the appropriate control under wxPython,
then I can't use CaptureMouse.  A mouse click outside the popup window
meant to dismiss the popup window will get picked up by some other control. 
I suppose that I will have to add an event handler to the uber parent in
which I check whether the popup is visible and hide it if it is.  If it is
not, then perhaps event.Skip() will resume normal propagation of the mouse
click.  I don't like this solution because the top-level window has to know
about this control.

> OTOH, if you use generic widgets then sending
> them a wx event like this can be done to simulate events.

Is that a useful capability?  To me it seems as if it would be more useful
for ProcessEvent to propagate the native event as well, but then I have my
nose pressed against this problem.
-- 
Jeffrey Barish





More information about the wxpython-users mailing list