X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/99411465804808488febdc61ee7e7250b8a94f2d..c92ad09968b09fe6e4cf17d9e962b51b7caaee91:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 0daf721601..9f014eb75e 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1858,8 +1858,6 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, parent = GetItemParent( parent ); } - EnsureVisible( itemId ); - // ctrl press if (unselect_others) { @@ -1891,6 +1889,11 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, RefreshLine( m_current ); } + // This can cause idle processing to select the root + // if no item is selected, so it must be after the + // selection is set + EnsureVisible( itemId ); + event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); GetEventHandler()->ProcessEvent( event ); }