From 982afb26d21184e606898c03bbe8355aa2002af6 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 1 Sep 2000 21:30:18 +0000 Subject: [PATCH] 1. Setting the listctrl as the event object before sending the event to any user event handlers. 2. InsertItem returns the actual index used when given one beyond the end of the list. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index c6efdbf90f..40cb90565f 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1703,7 +1703,7 @@ void wxListMainWindow::DeleteLine( wxListLineData *line ) void wxListMainWindow::EditLabel( long item ) { - wxCHECK_RET( ((size_t)item < m_lines.GetCount()), + wxCHECK_RET( ((size_t)item < m_lines.GetCount()), wxT("wrong index in wxListCtrl::Edit()") ); m_currentEdit = &m_lines[(size_t)item]; @@ -1768,6 +1768,7 @@ void wxListMainWindow::OnRenameAccept() void wxListMainWindow::OnMouse( wxMouseEvent &event ) { + event.SetEventObject( GetParent() ); if (GetParent()->GetEventHandler()->ProcessEvent( event)) return; if (!m_current) return; @@ -1887,7 +1888,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) else if (event.ShiftDown()) { size_t j; - + m_current = line; int numOfCurrent = -1; @@ -2095,7 +2096,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) if (index != wxNOT_FOUND) { index -= steps; - if (index < 0) index = 0; + if (index < 0) index = 0; OnArrowChar( &m_lines[index], event.ShiftDown() ); } break; @@ -2116,7 +2117,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) if (index != wxNOT_FOUND) { index += steps; - if ((size_t)index >= m_lines.GetCount()) + if ((size_t)index >= m_lines.GetCount()) index = m_lines.GetCount()-1; OnArrowChar( &m_lines[index], event.ShiftDown() ); } @@ -2144,7 +2145,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) if (index != wxNOT_FOUND) { index += m_visibleLines; - if ((size_t)index >= m_lines.GetCount()) + if ((size_t)index >= m_lines.GetCount()) index = m_lines.GetCount()-1; OnArrowChar( &m_lines[index], event.ShiftDown() ); } @@ -2381,7 +2382,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) wxClientDC dc(this); dc.SetFont( GetFont() ); int max = 10; - + for (size_t i = 0; i < m_lines.GetCount(); i++) { wxListLineData *line = &m_lines[i]; @@ -2953,6 +2954,7 @@ void wxListMainWindow::InsertItem( wxListItem &item ) else { m_lines.Add( line ); + item.m_itemId = m_lines.GetCount(); } }