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:
parent
abc4576ffe
commit
c8d2195791
1 changed files with 12 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue