added wxWindow::HandleAsNavigationKey() helper for handling (not only) TAB key in custom controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2700,12 +2700,33 @@ bool wxWindowBase::DoNavigateIn(int flags)
|
||||
return false;
|
||||
#else // !wxHAS_NATIVE_TAB_TRAVERSAL
|
||||
wxNavigationKeyEvent eventNav;
|
||||
wxWindow *focused = FindFocus();
|
||||
eventNav.SetCurrentFocus(focused);
|
||||
eventNav.SetEventObject(focused);
|
||||
eventNav.SetFlags(flags);
|
||||
eventNav.SetEventObject(FindFocus());
|
||||
return GetEventHandler()->ProcessEvent(eventNav);
|
||||
#endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL
|
||||
}
|
||||
|
||||
bool wxWindowBase::HandleAsNavigationKey(const wxKeyEvent& event)
|
||||
{
|
||||
if ( event.GetKeyCode() != WXK_TAB )
|
||||
return false;
|
||||
|
||||
int flags = wxNavigationKeyEvent::FromTab;
|
||||
|
||||
if ( event.ShiftDown() )
|
||||
flags |= wxNavigationKeyEvent::IsBackward;
|
||||
else
|
||||
flags |= wxNavigationKeyEvent::IsForward;
|
||||
|
||||
if ( event.ControlDown() )
|
||||
flags |= wxNavigationKeyEvent::WinChange;
|
||||
|
||||
Navigate(flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move)
|
||||
{
|
||||
// check that we're not a top level window
|
||||
|
Reference in New Issue
Block a user