Applied backport for #11157: Generic wxTreeCtrl - SelectItem toggles selection if item already in desired state
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2052,15 +2052,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