Make wxSimpleHtmlListBox::Delete() consistent with wxListBox
Also remove the selection when deleting the selected item, or any item before it, in this class, for consistency with the native wxListBox.
This commit is contained in:
@@ -672,6 +672,18 @@ void wxSimpleHtmlListBox::Clear()
|
||||
|
||||
void wxSimpleHtmlListBox::DoDeleteOneItem(unsigned int n)
|
||||
{
|
||||
// For consistency with the other wxItemContainer-derived classes, deselect
|
||||
// the currently selected item if it, or any item before it, is being
|
||||
// deleted, from a single-selection control.
|
||||
if ( !HasMultipleSelection() )
|
||||
{
|
||||
const int sel = GetSelection();
|
||||
if ( sel != wxNOT_FOUND && static_cast<unsigned>(sel) >= n )
|
||||
{
|
||||
SetSelection(wxNOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
m_items.RemoveAt(n);
|
||||
|
||||
m_HTMLclientData.RemoveAt(n);
|
||||
|
Reference in New Issue
Block a user