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:
parent
0396d31b57
commit
a95d5751f9
@ -822,6 +822,7 @@ void MyListCtrl::OnEndLabelEdit(wxListEvent& event)
|
|||||||
void MyListCtrl::OnDeleteItem(wxListEvent& event)
|
void MyListCtrl::OnDeleteItem(wxListEvent& event)
|
||||||
{
|
{
|
||||||
LogEvent(event, _T("OnDeleteItem"));
|
LogEvent(event, _T("OnDeleteItem"));
|
||||||
|
wxLogMessage( wxT("Number of items when delete event is sent: %d"), GetItemCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyListCtrl::OnDeleteAllItems(wxListEvent& event)
|
void MyListCtrl::OnDeleteAllItems(wxListEvent& event)
|
||||||
|
@ -697,7 +697,7 @@ public:
|
|||||||
|
|
||||||
// send out a wxListEvent
|
// send out a wxListEvent
|
||||||
void SendNotify( size_t line,
|
void SendNotify( size_t line,
|
||||||
wxEventType command,
|
wxEventType command,
|
||||||
const wxPoint& point = wxDefaultPosition );
|
const wxPoint& point = wxDefaultPosition );
|
||||||
|
|
||||||
// override base class virtual to reset m_lineHeight when the font changes
|
// override base class virtual to reset m_lineHeight when the font changes
|
||||||
@ -2842,6 +2842,7 @@ void wxListMainWindow::SendNotify( size_t line,
|
|||||||
{
|
{
|
||||||
wxListEvent le( command, GetParent()->GetId() );
|
wxListEvent le( command, GetParent()->GetId() );
|
||||||
le.SetEventObject( GetParent() );
|
le.SetEventObject( GetParent() );
|
||||||
|
|
||||||
le.m_itemIndex = line;
|
le.m_itemIndex = line;
|
||||||
|
|
||||||
// set only for events which have position
|
// 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
|
// 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
|
// the lines, even those which are not visible now and this is precisely
|
||||||
// what we're trying to avoid
|
// what we're trying to avoid
|
||||||
if ( !IsVirtual() && (command != wxEVT_COMMAND_LIST_DELETE_ITEM) )
|
if ( !IsVirtual() )
|
||||||
{
|
{
|
||||||
if ( line != (size_t)-1 )
|
if ( line != (size_t)-1 )
|
||||||
{
|
{
|
||||||
@ -4332,11 +4333,11 @@ void wxListMainWindow::DeleteItem( long lindex )
|
|||||||
if ( m_current != index || m_current == count - 1 )
|
if ( m_current != index || m_current == count - 1 )
|
||||||
m_current--;
|
m_current--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( InReportView() )
|
if ( InReportView() )
|
||||||
{
|
{
|
||||||
// mark the Column Max Width cache as dirty if the items in the line
|
// mark the Column Max Width cache as dirty if the items in the line
|
||||||
// we're deleting contain the Max Column Width
|
// we're deleting contain the Max Column Width
|
||||||
wxListLineData * const line = GetLine(index);
|
wxListLineData * const line = GetLine(index);
|
||||||
wxListItemDataList::compatibility_iterator n;
|
wxListItemDataList::compatibility_iterator n;
|
||||||
wxListItemData *itemData;
|
wxListItemData *itemData;
|
||||||
@ -4358,6 +4359,8 @@ void wxListMainWindow::DeleteItem( long lindex )
|
|||||||
ResetVisibleLinesRange();
|
ResetVisibleLinesRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendNotify( index, wxEVT_COMMAND_LIST_DELETE_ITEM, wxDefaultPosition );
|
||||||
|
|
||||||
if ( IsVirtual() )
|
if ( IsVirtual() )
|
||||||
{
|
{
|
||||||
m_countVirt--;
|
m_countVirt--;
|
||||||
@ -4371,8 +4374,6 @@ void wxListMainWindow::DeleteItem( long lindex )
|
|||||||
// we need to refresh the (vert) scrollbar as the number of items changed
|
// we need to refresh the (vert) scrollbar as the number of items changed
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
|
||||||
SendNotify( index, wxEVT_COMMAND_LIST_DELETE_ITEM );
|
|
||||||
|
|
||||||
RefreshAfter(index);
|
RefreshAfter(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user