Send delete item event just before the item is actually
deleted (as per wxMSW). Also include the client data (long value) in the event. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -822,6 +822,7 @@ void MyListCtrl::OnEndLabelEdit(wxListEvent& event)
|
||||
void MyListCtrl::OnDeleteItem(wxListEvent& event)
|
||||
{
|
||||
LogEvent(event, _T("OnDeleteItem"));
|
||||
wxLogMessage( wxT("Number of items when delete event is sent: %d"), GetItemCount() );
|
||||
}
|
||||
|
||||
void MyListCtrl::OnDeleteAllItems(wxListEvent& event)
|
||||
|
@@ -2842,6 +2842,7 @@ void wxListMainWindow::SendNotify( size_t line,
|
||||
{
|
||||
wxListEvent le( command, GetParent()->GetId() );
|
||||
le.SetEventObject( GetParent() );
|
||||
|
||||
le.m_itemIndex = line;
|
||||
|
||||
// set only for events which have position
|
||||
@@ -2852,7 +2853,7 @@ void wxListMainWindow::SendNotify( size_t line,
|
||||
// program has it anyhow and if we did it would result in accessing all
|
||||
// the lines, even those which are not visible now and this is precisely
|
||||
// what we're trying to avoid
|
||||
if ( !IsVirtual() && (command != wxEVT_COMMAND_LIST_DELETE_ITEM) )
|
||||
if ( !IsVirtual() )
|
||||
{
|
||||
if ( line != (size_t)-1 )
|
||||
{
|
||||
@@ -4358,6 +4359,8 @@ void wxListMainWindow::DeleteItem( long lindex )
|
||||
ResetVisibleLinesRange();
|
||||
}
|
||||
|
||||
SendNotify( index, wxEVT_COMMAND_LIST_DELETE_ITEM, wxDefaultPosition );
|
||||
|
||||
if ( IsVirtual() )
|
||||
{
|
||||
m_countVirt--;
|
||||
@@ -4371,8 +4374,6 @@ void wxListMainWindow::DeleteItem( long lindex )
|
||||
// we need to refresh the (vert) scrollbar as the number of items changed
|
||||
m_dirty = true;
|
||||
|
||||
SendNotify( index, wxEVT_COMMAND_LIST_DELETE_ITEM );
|
||||
|
||||
RefreshAfter(index);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user