From fbf3385651cebd7e029efb01cf7c8eae055fe3f3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 6 May 2010 12:58:22 +0000 Subject: [PATCH] Make keyboard navigation in generic wxTreeCtrl more Mac-like under OS X. In the native OS X tree control right cursor arrow expands the current item and the left one collapses it if it's expanded, make the generic control work like this too under Mac. Closes #12019. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index b88ba3851a..70f6bfcd3c 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3076,6 +3076,21 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) // end : go to last item without opening parents // alnum : start or continue searching for the item with this prefix int keyCode = event.GetKeyCode(); + +#ifdef __WXOSX__ + // Make the keys work as they do in the native control: + // right => expand + // left => collapse if current item is expanded + if (keyCode == WXK_RIGHT) + { + keyCode = '+'; + } + else if (keyCode == WXK_LEFT && IsExpanded(m_current)) + { + keyCode = '-'; + } +#endif // __WXOSX__ + switch ( keyCode ) { case '+': -- 2.45.2