I have a TreeCtrl object for which I want to implement a context menu n right-click. On Windows everything works but on Linux I have a problem:
On Linux, the wx.EVT_TREE_ITEM_RIGHT_CLICK method does not get called when I right-click, instead the wx.EVT_TREE_SEL_CHANGED gets called. If I remove the binding for wx.EVT_TREE_SEL_CHANGED the right-click method does get called.
I have tried using EVT_LEFT_UP and EVT_LEFT_UP instead of SEL_CHANGED but it makes no difference.
I have been searching for a couple of days to try and find out what is happening but cannot find anything relevant.
Any help gratefully received!
here is my code
self.Bind(
wx.EVT_TREE_SEL_CHANGED,
self.on_item_selected,
self._tree
)
self.Bind(
wx.EVT_TREE_ITEM_ACTIVATED,
self.on_item_activated,
self._tree
)
self.Bind(
wx.EVT_TREE_ITEM_RIGHT_CLICK,
self.on_tree_right_click,
self._tree
)