set the focus to the tree before generating the selection change events to have a more expected (and compatible with other platforms) order of tree and focus events
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2593,6 +2593,19 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
event.m_itemOld = tv->itemOld.hItem;
|
||||
}
|
||||
}
|
||||
|
||||
// we receive this message from WM_LBUTTONDOWN handler inside
|
||||
// comctl32.dll and so before the click is passed to
|
||||
// DefWindowProc() which sets the focus to the window which was
|
||||
// clicked and this can lead to unexpected event sequences: for
|
||||
// example, we may get a "selection change" event from the tree
|
||||
// before getting a "kill focus" event for the text control which
|
||||
// had the focus previously, thus breaking user code doing input
|
||||
// validation
|
||||
//
|
||||
// to avoid such surprises, we force the generation of focus events
|
||||
// now, before we generate the selection change ones
|
||||
SetFocus();
|
||||
break;
|
||||
|
||||
// instead of explicitly checking for _WIN32_IE, check if the
|
||||
|
Reference in New Issue
Block a user