Don't send event from wxMSW::wxListCtrl::DeleteAllItems() if it did nothing.
wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS should only be sent if the control hadn't been empty before. Document this behaviour and adjust wxMSW to match the other platforms. Also document the return value better. Closes #12336. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1464,7 +1464,9 @@ bool wxListCtrl::DeleteItem(long item)
|
||||
// Deletes all items
|
||||
bool wxListCtrl::DeleteAllItems()
|
||||
{
|
||||
return ListView_DeleteAllItems(GetHwnd()) != 0;
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Deletes all items
|
||||
|
Reference in New Issue
Block a user