Custom Control Event Overrides

Hey wxPython-ers!
I am building a ListCtrl subclass and have run into events behaving
strangely.
I have bound EVT_RIGHT_UP using a pretty typical form:
self.Bind(wx.EVT_RIGHT_UP, self.OnRClickWindow)
However, the callback is only firing with a double-click on right button
(plus some other strange events like right-click, hold, and drag on a list
item).
I /believe/ this is being caused by EVT_LIST_ITEM_RIGHT_CLICK intercepting
EVT_RIGHT_UP and handling it with its own unique behavior.

Has anyone run into such an issue before? How can I get the typical
EVT_RIGHT_UP to behave normally? I'm not using EVT_LIST_ITEM_RIGHT_CLICK
because I also need to handle right-clicks on the empty space in the window.

Thanks!

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Custom-Control-Event-Overrides-tp4521960p4521960.html
Sent from the wxPython-users mailing list archive at Nabble.com.

If you catch the EVT_RIGHT_DOWN event then you should be able to prevent it from being handled by the native widget by not calling event.Skip in the handler. You can then either do what you need in that handler or just wait for the _UP event to arrive and deal with it there like you are already.

···

On 6/24/11 11:57 AM, rshemaka wrote:

Hey wxPython-ers!
I am building a ListCtrl subclass and have run into events behaving
strangely.
I have bound EVT_RIGHT_UP using a pretty typical form:
self.Bind(wx.EVT_RIGHT_UP, self.OnRClickWindow)
However, the callback is only firing with a double-click on right button
(plus some other strange events like right-click, hold, and drag on a list
item).
I /believe/ this is being caused by EVT_LIST_ITEM_RIGHT_CLICK intercepting
EVT_RIGHT_UP and handling it with its own unique behavior.

Has anyone run into such an issue before? How can I get the typical
EVT_RIGHT_UP to behave normally? I'm not using EVT_LIST_ITEM_RIGHT_CLICK
because I also need to handle right-clicks on the empty space in the window.

--
Robin Dunn
Software Craftsman