Don't send EXPANDED in generic wxTreeCtrl if not really expanded
On demand expandable items can fail to be actually expanded when the user attempts to expand them, but the generic version of wxTreeCtrl still sent an EXPANDED event in this case, which wasn't useful and differed from the native MSW version. Fix this and only send the event if the item was really expanded. Closes https://github.com/wxWidgets/wxWidgets/pull/1450 Closes #13886.
This commit is contained in:
committed by
Vadim Zeitlin
parent
47d58db2fb
commit
a6b92cb313
@@ -1886,8 +1886,16 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId)
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
// Don't send EXPANDED event unconditionally: if this is an item for which
|
||||
// SetItemHasChildren(true) had been called before, but no children have
|
||||
// been added from the EXPANDING handler, we shouldn't consider the item to
|
||||
// be really expanded.
|
||||
wxTreeItemIdValue cookie;
|
||||
if ( GetFirstChild(item, cookie).IsOk() )
|
||||
{
|
||||
event.SetEventType(wxEVT_TREE_ITEM_EXPANDED);
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId)
|
||||
|
Reference in New Issue
Block a user