wxPopupTransientWindow

Fantastic!

Actually, I don't even need the wxEvtHandler, I just tried it when
specifying a regular handler failed. For my purposes

EVT_RIGHT_DOWN(self.panel, self.onRightDown)

Gets me where I want to go.

Thanks again,

S.

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Monday, April 28, 2003 8:31 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] wxPopupTransientWindow

Sean Slattery wrote:
> I'd like to be able to make one of these disappear on right
click as well as
> left click, but I can't seem to trap an EVT_RIGHT_DOWN
event. I thought I
> could push the following event handler onto my subclass of
> wxPopupTransientWindow:
>
> class TestEventHandler(wxEvtHandler):
>
> def __init__(self):
> wxEvtHandler.__init__(self)
>
> EVT_RIGHT_DOWN(self, self.onRightDown)
>
> def onRightDown(self, event):
> print "RIGHT DOWN in TestEventHandler"
> event.Skip()
>
> But it doesn't see any right down event. For completeness,
the start of my
> subclass is:
>
> class FixedSplitTreePopup(wxPopupTransientWindow):
>
> def __init__(self, parent, position, size):
> wxPopupTransientWindow.__init__(self, parent,
wxSIMPLE_BORDER)
>
> self.panel = wxPanel(self, -1)
>
> # Overridable function to fill the window with whatever
> sz = self.FillPanel()
>
> self.panel.SetSize((sz.width + 20, sz.height + 20))
> self.SetSize(self.panel.GetSize())
>
> self.Position(position, size)
> self.Popup()
>
> self.PushEventHandler(TestEventHandler())

The wxPopupTransientWindow pushes some wxEventHandlers onto the child
window, and then causes the mouse to be captured by the child window
too. So if you change the last line to this it may work:

  self.panel.PushEventHandler(TestEventHandler())

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwindows.org