hello,
I've another small problem with CustomTreeCtrl:
I've bound the "Del" key (windows) to both a menu and an accelerator key:
self.Bind ( wx.EVT_MENU, self.On_Delete, PU.items [5] ) # Del
# Create bindings for accelerator keys
aTable = wx.AcceleratorTable([\
( wx.ACCEL_NORMAL, wx.WXK_DELETE, PU.IDs[5] ),
])
self.SetAcceleratorTable(aTable)
Because I normally want to use them to delete treenodes.
But in case I'm editing a treenode, I want that the "Del" has the normal editing functionality.
So I tried:
def On_Delete ( self, event ) :
if not ( self.GetEditControl () ) :
self.Delete_Item ( self.GetSelection () )
else :
event.Skip ()
But the Skip() doesn't brings any help
So I tried the next, ...
def On_Delete ( self, event ) :
if not ( self.GetEditControl () ) :
self.Delete_Item ( self.GetSelection () )
else :
event.m_keyCode = wx.WXK_DELETE
self._textCtrl.EmulateKeyPress(event)
but the above gives the following error message:
Traceback (most recent call last):
File "D:\Data_Python\P24_support\tree_support.py", line 177, in On_Delete
self._textCtrl.EmulateKeyPress(event)
File "P:\Python\Lib\site-packages\wx-2.8-msw-ansi\wx\_controls.py", line 1809, in EmulateKeyPress
return _controls_.TextCtrl_EmulateKeyPress(*args, **kwargs)
TypeError: in method 'TextCtrl_EmulateKeyPress', expected argument 2 of type 'wxKeyEvent const &'
Any other ideas ?
thanks,
Stef Mientki