Don't grab focus when calling wxTreeCtrl::SelectItem().
The workaround for the unexpected events order introduced in r49588 should only apply to the situation when the user selects an item in the tree, not when it's done programmatically as this results in unexpected focus changes (see #11274). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1976,13 +1976,15 @@ void wxTreeCtrl::SelectItem(const wxTreeItemId& item, bool select)
|
||||
|
||||
if ( IsTreeEventAllowed(changingEvent) )
|
||||
{
|
||||
TempSetter set(m_changingSelection);
|
||||
|
||||
if ( !TreeView_SelectItem(GetHwnd(), HITEM(itemNew)) )
|
||||
{
|
||||
wxLogLastError(wxT("TreeView_SelectItem"));
|
||||
}
|
||||
else // ok
|
||||
{
|
||||
SetFocusedItem(item);
|
||||
::SetFocus(GetHwnd(), HITEM(item));
|
||||
|
||||
wxTreeEvent changedEvent(wxEVT_COMMAND_TREE_SEL_CHANGED,
|
||||
this, itemNew);
|
||||
@@ -3512,7 +3514,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
//
|
||||
// to avoid such surprises, we force the generation of focus events
|
||||
// now, before we generate the selection change ones
|
||||
SetFocus();
|
||||
if ( !m_changingSelection )
|
||||
SetFocus();
|
||||
break;
|
||||
|
||||
// instead of explicitly checking for _WIN32_IE, check if the
|
||||
|
Reference in New Issue
Block a user