Ensure that InsertItem doesn't lead to a crash in virtual mode, and don't use SortProperty to determined column clicked in virtual mode as we cannot sort virtual controls and it returns an invalid value.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier
2006-11-27 18:40:06 +00:00
parent 7f28a65658
commit 3611cec2e7

View File

@@ -149,6 +149,9 @@ static pascal OSStatus wxMacListCtrlEventHandler( EventHandlerCallRef handler ,
GetDataBrowserSortProperty(controlRef, &col);
int column = col - kMinColumnId;
le.m_col = column;
// FIXME: we can't use the sort property for virtual listctrls
// so we need to find a better way to determine which column was clicked...
if (!window->IsVirtual())
window->GetEventHandler()->ProcessEvent( le );
}
result = CallNextEventHandler(handler, event);
@@ -805,7 +808,6 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const
if (m_dbImpl)
{
wxColumnList::compatibility_iterator node = m_colsInfo.Item( col );
wxASSERT_MSG( node, _T("invalid column index in wxMacListCtrlItem") );
wxListItem* column = node->GetData();
@@ -1818,7 +1820,7 @@ long wxListCtrl::InsertItem(wxListItem& info)
if (m_genericImpl)
return m_genericImpl->InsertItem(info);
if (m_dbImpl)
if (m_dbImpl && !IsVirtual())
{
int count = GetItemCount();
@@ -1830,10 +1832,10 @@ long wxListCtrl::InsertItem(wxListItem& info)
event.SetEventObject( this );
event.m_itemIndex = info.m_itemId;
GetEventHandler()->ProcessEvent( event );
}
return info.m_itemId;
}
return -1;
}
long wxListCtrl::InsertItem(long index, const wxString& label)
{