[wxPython-users] Multiple events

Robin Dunn robin at alldunn.com
Tue May 1 09:59:25 PDT 2007


Brian Wolf wrote:
> Hi,
> 
> I'm writing an application that has a UI like FileZilla or Windows 
> Explorer: a splitter window with two panes.  The left pane is a scrolled 
> window containing a tree control.  The right pane is a scrolled window 
> where the selected object is displayed.
> 
> When the user left-clicks a object in the tree, the intended behaviour 
> is to display that object in the right pane.  But, if the user 
> right-clicks an object, the application should instead display a popup 
> menu offering actions to take.  It seems that both an 
> EVT_TREE_ITEM_RIGHT_CLICK and an EVT_TREE_SEL_CHANGED are being 
> invoked.  Is there a straight-forward way to "turn off" the 
> EVT_TREE_SEL_CHANGED event in this particular case (so that only the 
> EVT_TREE_ITEM_RIGHT_CLICK event is handled)?

You can also catch EVT_RIGHT_DOWN and in the handler set a flag and call 
event.Skip() then in the handler for EVT_TREE_SEL_CHANGED you can check 
that flag and if it is set do nothing but clear the flag and return.


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





More information about the wxpython-users mailing list