diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 5ff0f681ff..fdda0c22d2 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -144,6 +144,9 @@ BEGIN_EVENT_TABLE(MyTreeCtrl, wxTreeCtrl) EVT_TREE_SEL_CHANGING(TreeTest_Ctrl, MyTreeCtrl::OnSelChanging) EVT_TREE_KEY_DOWN(TreeTest_Ctrl, MyTreeCtrl::OnTreeKeyDown) EVT_TREE_ITEM_ACTIVATED(TreeTest_Ctrl, MyTreeCtrl::OnItemActivated) + + EVT_RIGHT_DOWN(MyTreeCtrl::OnRMouseDown) + EVT_RIGHT_UP(MyTreeCtrl::OnRMouseUp) EVT_RIGHT_DCLICK(MyTreeCtrl::OnRMouseDClick) END_EVENT_TABLE() @@ -1216,6 +1219,20 @@ void MyTreeCtrl::ShowMenu(wxTreeItemId id, const wxPoint& pt) #endif // wxUSE_MENUS } +void MyTreeCtrl::OnRMouseDown(wxMouseEvent& event) +{ + wxLogMessage(wxT("Right mouse button down")); + + event.Skip(); +} + +void MyTreeCtrl::OnRMouseUp(wxMouseEvent& event) +{ + wxLogMessage(wxT("Right mouse button up")); + + event.Skip(); +} + void MyTreeCtrl::OnRMouseDClick(wxMouseEvent& event) { wxTreeItemId id = HitTest(event.GetPosition()); @@ -1227,6 +1244,8 @@ void MyTreeCtrl::OnRMouseDClick(wxMouseEvent& event) if ( item ) wxLogMessage(wxT("Item '%s' under mouse"), item->GetDesc()); } + + event.Skip(); } static inline const wxChar *Bool2String(bool b) diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 778be3b787..17edaf267f 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -86,6 +86,9 @@ public: void OnSelChanging(wxTreeEvent& event); void OnTreeKeyDown(wxTreeEvent& event); void OnItemActivated(wxTreeEvent& event); + + void OnRMouseDown(wxMouseEvent& event); + void OnRMouseUp(wxMouseEvent& event); void OnRMouseDClick(wxMouseEvent& event); void GetItemsRecursively(const wxTreeItemId& idParent,