Refresh virtual wxListCtrl in wxMSW after deleting all its items
In principle, calling DeleteAllItems() on a virtual list control doesn't make sense at all, but apparently people actually do it and it mostly works except that the controls scrollbars are not updated, so add a call to Refresh() to update them too, for consistency with DeleteItem() which similarly doesn't make sense for virtual controls but where we also explicitly support them for some reason.
This commit is contained in:
parent
535b73c1f1
commit
d49abaaec4
@ -1415,7 +1415,18 @@ bool wxListCtrl::DeleteAllItems()
|
||||
{
|
||||
// Calling ListView_DeleteAllItems() will always generate an event but we
|
||||
// shouldn't do it if the control is empty
|
||||
return !GetItemCount() || ListView_DeleteAllItems(GetHwnd()) != 0;
|
||||
if ( !GetItemCount() )
|
||||
return true;
|
||||
|
||||
if ( !ListView_DeleteAllItems(GetHwnd()) )
|
||||
return false;
|
||||
|
||||
// Virtual controls don't refresh their scrollbar position automatically,
|
||||
// do it for them when clearing them.
|
||||
if ( IsVirtual() )
|
||||
Refresh();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Deletes all items
|
||||
|
Loading…
Reference in New Issue
Block a user