Invalidate selection of item being removed from wxNSComboBoxControl

We need to explicitly invalidate selection of item being removed
because it's not done by NSComboBox (selection index is retained).
This commit is contained in:
Artur Wieczorek
2021-09-20 22:00:23 +02:00
committed by AW
parent fee249f3ae
commit 2f3fc152bf

View File

@@ -294,6 +294,14 @@ void wxNSComboBoxControl::InsertItem(int pos, const wxString& item)
void wxNSComboBoxControl::RemoveItem(int pos)
{
SendEvents(false);
// Explicitly deselect item being removed
int selIdx = [m_comboBox indexOfSelectedItem];
if (selIdx!= -1 && selIdx == pos)
{
[m_comboBox deselectItemAtIndex:selIdx];
}
[m_comboBox removeItemAtIndex:pos];
SendEvents(true);
}