Multiple events

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)?

Thanks!
Brian

···

--

------------------------------------------------------

Brian Wolf |
Activus Technologies Corporation |
brian@activustech.com | 410.367.2958 |

------------------------------------------------------

Helping organizations gain a competitive advantage |
through intelligent application of technology. |

------------------------------------------------------

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!