X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1526a6787a5dc39dd7c07662a355818527041e7..cbc9145c04bd3ea0a228906c8363fa8f47e3acf9:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 611a7ea7e4..e4d81b2b4c 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1395,10 +1395,12 @@ wxTreeItemId wxGenericTreeCtrl::FindItem(const wxTreeItemId& idParent, } // and try all the items (stop when we get to the one we started from) - while ( id != idParent && !GetItemText(id).Lower().StartsWith(prefix) ) + while (id.IsOk() && id != idParent && !GetItemText(id).Lower().StartsWith(prefix) ) { id = GetNext(id); } + // If we haven't found the item, id.IsOk() will be false, as per + // documentation } return id; @@ -1890,9 +1892,16 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select) { wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") ); + + wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item); + if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() ) + return; item->SetHilight(false); RefreshLine(item); + + event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); + GetEventHandler()->ProcessEvent( event ); } }