X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..2b63ff5d388c5877733bf256ae29e9001de12136:/wxPython/demo/wxTreeCtrl.py diff --git a/wxPython/demo/wxTreeCtrl.py b/wxPython/demo/wxTreeCtrl.py index 9f1c20183a..64f8662fd4 100644 --- a/wxPython/demo/wxTreeCtrl.py +++ b/wxPython/demo/wxTreeCtrl.py @@ -21,7 +21,8 @@ class MyTreeCtrl(wxTreeCtrl): class TestTreeCtrlPanel(wxPanel): def __init__(self, parent, log): - wxPanel.__init__(self, parent, -1) + # Use the WANTS_CHARS style so the panel doesn't eat the Return key. + wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS) EVT_SIZE(self, self.OnSize) self.log = log @@ -68,6 +69,7 @@ class TestTreeCtrlPanel(wxPanel): EVT_TREE_SEL_CHANGED (self, tID, self.OnSelChanged) EVT_TREE_BEGIN_LABEL_EDIT(self, tID, self.OnBeginEdit) EVT_TREE_END_LABEL_EDIT (self, tID, self.OnEndEdit) + EVT_TREE_ITEM_ACTIVATED (self, tID, self.OnActivate) EVT_LEFT_DCLICK(self.tree, self.OnLeftDClick) EVT_RIGHT_DOWN(self.tree, self.OnRightClick) @@ -135,9 +137,16 @@ class TestTreeCtrlPanel(wxPanel): def OnSelChanged(self, event): self.item = event.GetItem() self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item)) - self.log.WriteText("BoundingRect: %s\n" % - self.tree.GetBoundingRect(self.item, true)) + if wxPlatform == '__WXMSW__': + self.log.WriteText("BoundingRect: %s\n" % + self.tree.GetBoundingRect(self.item, true)) + #items = self.tree.GetSelections() + #print map(self.tree.GetItemText, items) + event.Skip() + + def OnActivate(self, evt): + self.log.WriteText("OnActivate: %s\n" % self.tree.GetItemText(self.item)) #--------------------------------------------------------------------------- @@ -160,11 +169,6 @@ def runTest(frame, nb, log): - - - - - overview = """\ A tree control presents information as a hierarchy, with items that may be expanded to show further items. Items in a tree control are referenced by wxTreeItemId handles.