G'day all,
I am in the process of switching a wxPython app of mine from
using wxTreeCtrl to MVCTree and I have hit a bit of a stumbling block.
I have a module that contains the data that the MVCTree is representing and
a
TreeModel thats working to some extent.
What I would like to do is associate a pop up menu with each of the nodes
based on some of the methods in the classes represented by each of the
nodes, however I cannot work out how to get the right click event processed
correctly.
I tried creating a tree class of my own (derived from MVCTree) with an
EVT_RIGHT_DOWN handler
but this event is never caught by this handler.
I really don't have any idea where this should go, did I do the right thing
and just stuff it up
or have I got this all wrong?
This is the code fragment......
class MyTree( wxMVCTree ):
def __init__( self,parent ):
wxMVCTree.__init__( self,parent, -1 )
EVT_RIGHT_DOWN(self, self.onRightClick)
def onRightClick(self, event):
print "got a Right CLICK"
node = self.GetSelection()
popmenu = wxMenu("")
for method in node.publicMethods:
print "adding->", method.__name__
reuseId = addMenu(popmenu,method.__name__,method.__name__,method)
self.PopupMenu(popmenu,event.GetPosition())
TIA
----Gareth Walters