is discouraged
- Added ..._CMD_... variants for wxGrid event table entry macros
taking window identifiers
+- Added wxWindowBase::Navigate for programmatic navigation to the next
+ control.
+- On most platforms, wxTextCtrl::OnChar now inserts a tab character if
+ wxTE_PROCESS_TAB is set, or navigates to the next control if not.
Unix:
\end{twocollist}}
}
+\membersection{wxWindow::Navigate}\label{wxwindownavigate}
+
+\func{bool}{Navigate}{\param{bool}{ direction = true}, \param{bool}{ windowChange = false}}
+
+Does keyboard navigation from this window to another, by sending
+a wxNavigationKeyEvent.
+
+\wxheading{Parameters}
+
+\docparam{direction}{{\tt true} to navigate forwards, {\tt false} to navigate backwards.}
+
+\docparam{windowChange}{{\tt true} if the navigation is a window change.}
+
+\wxheading{Remarks}
+
+You may wish to call this from a text control custom keypress handler to do the default
+navigation behaviour for the tab key, since the standard default behaviour for
+a multiline text control with the wxTE\_PROCESS\_TAB style is to insert a tab
+and not navigate to the next control.
+
%% VZ: wxWindow::OnXXX() functions should not be documented but I'm leaving
%% the old docs here in case we want to move any still needed bits to
%% the right location (i.e. probably the corresponding events docs)
// set this child as temporary default
virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win)) { }
+ // Navigates in the specified direction by sending a wxNavigationKeyEvent
+ virtual bool Navigate(bool direction = true, bool windowChange = false);
+
// parent/children relations
// -------------------------
return wxEvtHandler::TryParent(event);
}
+// ----------------------------------------------------------------------------
+// navigation
+// ----------------------------------------------------------------------------
+
+// Navigates in the specified direction.
+bool wxWindowBase::Navigate(bool direction, bool windowChange)
+{
+ wxNavigationKeyEvent eventNav;
+ eventNav.SetDirection(direction);
+ eventNav.SetWindowChange(windowChange);
+ eventNav.SetEventObject(this);
+ if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
+ {
+ return true;
+ }
+ return false;
+}
+
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
break;
case WXK_TAB:
- // always produce navigation event - even if we process TAB
- // ourselves the fact that we got here means that the user code
- // decided to skip processing of this TAB - probably to let it
- // do its default job.
+ if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{
- wxNavigationKeyEvent eventNav;
- eventNav.SetDirection(!event.ShiftDown());
- eventNav.SetWindowChange(event.ControlDown());
- eventNav.SetEventObject(this);
-
- if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
+ if (Navigate(!event.ShiftDown(), event.ControlDown()))
return;
-
- event.Skip() ;
- return;
}
break;
}
break;
case WXK_TAB:
- // always produce navigation event - even if we process TAB
- // ourselves the fact that we got here means that the user code
- // decided to skip processing of this TAB - probably to let it
- // do its default job.
+ if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{
- wxNavigationKeyEvent eventNav;
- eventNav.SetDirection(!event.ShiftDown());
- eventNav.SetWindowChange(event.ControlDown());
- eventNav.SetEventObject(this);
-
- if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
+ if (Navigate(!event.ShiftDown(), event.ControlDown()))
return;
-
- event.Skip() ;
- return;
}
break;
}
break;
case WXK_TAB:
- // always produce navigation event -- even if we process TAB
- // ourselves the fact that we got here means that the user code
- // decided to skip processing of this TAB -- probably to let it
- // do its default job.
-
// ok, so this is getting absolutely ridiculous but I don't see
// any other way to fix this bug: when a multiline text control is
// inside a wxFrame, we need to generate the navigation event as
// the right thing to do would, of course, be to understand what
// the hell is IsDialogMessage() doing but this is beyond my feeble
// forces at the moment unfortunately
- if ( FindFocus() == this )
+ if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{
- wxNavigationKeyEvent eventNav;
- eventNav.SetDirection(!event.ShiftDown());
- eventNav.SetWindowChange(event.ControlDown());
- eventNav.SetEventObject(this);
-
- if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
- return;
+ if ( FindFocus() == this )
+ {
+ if (Navigate(!event.ShiftDown(), event.ControlDown()))
+ return;
+ }
+ }
+ else
+ {
+ // Insert tab since calling the default Windows handler
+ // doesn't seem to do it
+ WriteText(wxT("\t"));
}
break;
}