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
This commit is contained in:
@@ -3076,6 +3076,21 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
// end : go to last item without opening parents
|
// end : go to last item without opening parents
|
||||||
// alnum : start or continue searching for the item with this prefix
|
// alnum : start or continue searching for the item with this prefix
|
||||||
int keyCode = event.GetKeyCode();
|
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 )
|
switch ( keyCode )
|
||||||
{
|
{
|
||||||
case '+':
|
case '+':
|
||||||
|
Reference in New Issue
Block a user