Added workaround for wxGTK tab traversal problem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-10-21 14:35:17 +00:00
parent f275b5dbfd
commit b50e81c696

View File

@@ -4963,19 +4963,51 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
if ( keycode == WXK_TAB ) if ( keycode == WXK_TAB )
{ {
wxWindow* mainControl;
if ( HasInternalFlag(wxPG_FL_IN_MANAGER) )
mainControl = GetParent();
else
mainControl = this;
if ( !event.ShiftDown() ) if ( !event.ShiftDown() )
{ {
if ( !editorFocused && m_wndEditor ) if ( !editorFocused && m_wndEditor )
{
DoSelectProperty( m_selected, wxPG_SEL_FOCUS ); DoSelectProperty( m_selected, wxPG_SEL_FOCUS );
}
else else
{
// Tab traversal workaround for platforms on which
// wxWindow::Navigate() may navigate into first child
// instead of next sibling. Does not work perfectly
// in every scenario (for instance, when property grid
// is either first or last control).
#if defined(__WXGTK__)
wxWindow* sibling = mainControl->GetNextSibling();
if ( sibling )
sibling->SetFocusFromKbd();
#else
Navigate(wxNavigationKeyEvent::IsForward); Navigate(wxNavigationKeyEvent::IsForward);
#endif
}
} }
else else
{ {
if ( editorFocused ) if ( editorFocused )
{
UnfocusEditor(); UnfocusEditor();
}
else else
{
#if defined(__WXGTK__)
wxWindow* sibling = mainControl->GetPrevSibling();
if ( sibling )
sibling->SetFocusFromKbd();
#else
Navigate(wxNavigationKeyEvent::IsBackward); Navigate(wxNavigationKeyEvent::IsBackward);
#endif
}
} }
return; return;