Invalidate stored wxTreeItemIds when the corresponding item is deleted in wxMSW.
m_htSelStart and m_htClickedItem stored in wxTreeCtrl must be invalidated when the item they point to is deleted (which also happens when all the items are deleted), otherwise the selection doesn't behave correctly after doing it. Closes #11619. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1667,6 +1667,12 @@ void wxTreeCtrl::Delete(const wxTreeItemId& item)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( item == m_htSelStart )
|
||||
m_htSelStart.Unset();
|
||||
|
||||
if ( item == m_htClickedItem )
|
||||
m_htClickedItem.Unset();
|
||||
|
||||
if ( next.IsOk() )
|
||||
{
|
||||
wxTreeEvent changingEvent(wxEVT_COMMAND_TREE_SEL_CHANGING, this, next);
|
||||
@@ -1721,6 +1727,10 @@ void wxTreeCtrl::DeleteAllItems()
|
||||
// unlock tree selections on vista for the duration of this call
|
||||
TreeItemUnlocker unlock_all;
|
||||
|
||||
// invalidate all the items we store as they're going to become invalid
|
||||
m_htSelStart =
|
||||
m_htClickedItem = wxTreeItemId();
|
||||
|
||||
// delete the "virtual" root item.
|
||||
if ( GET_VIRTUAL_ROOT() )
|
||||
{
|
||||
|
Reference in New Issue
Block a user