Invalidate selection of item being removed from wxChoice (wxOSX)

We need to explicitly invalidate selection of item being removed
because it's not done by wxChoiceWidgetsImpl::RemoveItem().
This commit is contained in:
Artur Wieczorek
2021-09-22 19:37:08 +02:00
committed by AW
parent 37ad7bb30e
commit 711b548c59

View File

@@ -146,6 +146,11 @@ void wxChoice::DoDeleteOneItem(unsigned int n)
if ( HasClientObjectData() )
delete GetClientObject( n );
// Deselect item being removed
int selIdx = GetSelection();
if ( selIdx != -1 && selIdx == n )
SetSelection(-1);
dynamic_cast<wxChoiceWidgetImpl*>(GetPeer())->RemoveItem(n);
m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;