fix bug in generic wxTreeCtrl: calling SelectItem(true) on an already selected item shouldn't toggle its selection (see #10830)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2146,15 +2146,16 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId,
|
||||
|
||||
void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select)
|
||||
{
|
||||
wxGenericTreeItem * const item = (wxGenericTreeItem*) itemId.m_pItem;
|
||||
wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
|
||||
|
||||
if ( select )
|
||||
{
|
||||
DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE));
|
||||
if ( !item->IsSelected() )
|
||||
DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE));
|
||||
}
|
||||
else // deselect
|
||||
{
|
||||
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;
|
||||
|
Reference in New Issue
Block a user