Fix inserting items to wxRearrangeList (wxGTK)
Order array cannot be extended both in DoInsertItems() and DoInsertOneItem() functions because DoInsertOneItem() is invoked indirectly from DoInsertItems() (through the call to wxCheckListBox::DoInsertItems() and DoInsertItemsInLoop()) and therefore order array would be eventually extended by two items for one inserted list item. To avoid this duplicated actions, we should resign from overriding DoInsertOneItem().
This commit is contained in:
@@ -188,15 +188,6 @@ void wxRearrangeList::OnCheck(wxCommandEvent& event)
|
||||
m_order[n] = ~m_order[n];
|
||||
}
|
||||
|
||||
int wxRearrangeList::DoInsertOneItem(const wxString& item, unsigned int pos)
|
||||
{
|
||||
int ret = wxCheckListBox::DoInsertOneItem(item, pos);
|
||||
// Item is not checked initially.
|
||||
const int idx = ~m_order.size();
|
||||
m_order.Insert(idx, pos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wxRearrangeList::DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos,
|
||||
void **clientData, wxClientDataType type)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user