Menu/toolbar event handling now tries the window with the focus first.
wxTextCtrl processes cut, copy, paste, undo, redo commands and UI updates automatically. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -555,3 +555,26 @@ bool wxEvtHandler::OnClose()
|
||||
}
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// Find a window with the focus, that is also a descendant of the given window.
|
||||
// This is used to determine the window to initially send commands to.
|
||||
wxWindow* wxFindFocusDescendant(wxWindow* ancestor)
|
||||
{
|
||||
// Process events starting with the window with the focus, if any.
|
||||
wxWindow* focusWin = wxWindow::FindFocus();
|
||||
wxWindow* win = focusWin;
|
||||
|
||||
// Check if this is a descendant of this frame.
|
||||
// If not, win will be set to NULL.
|
||||
while (win)
|
||||
{
|
||||
if (win == ancestor)
|
||||
break;
|
||||
else
|
||||
win = win->GetParent();
|
||||
}
|
||||
if (win == (wxWindow*) NULL)
|
||||
focusWin = (wxWindow*) NULL;
|
||||
|
||||
return focusWin;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user