GetItem() now works (it was completely broken)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -464,23 +464,38 @@ wxTextCtrl* wxListCtrl::GetEditControl(void) const
|
||||
bool wxListCtrl::GetItem(wxListItem& info) const
|
||||
{
|
||||
LV_ITEM lvItem;
|
||||
lvItem.pszText = NULL;
|
||||
ZeroMemory(&lvItem, sizeof(lvItem)); // must set all fields to 0
|
||||
|
||||
lvItem.iItem = info.m_itemId;
|
||||
|
||||
if ( info.m_mask & wxLIST_MASK_TEXT )
|
||||
{
|
||||
lvItem.mask |= LVIF_TEXT;
|
||||
lvItem.pszText = new char[513];
|
||||
lvItem.cchTextMax = 512;
|
||||
}
|
||||
bool success = (::SendMessage((HWND) GetHWND(), LVM_GETITEM, 0, (LPARAM)& lvItem) != 0);
|
||||
|
||||
if ( !success )
|
||||
else
|
||||
{
|
||||
if (lvItem.pszText)
|
||||
delete[] lvItem.pszText;
|
||||
|
||||
return FALSE;
|
||||
lvItem.pszText = NULL;
|
||||
}
|
||||
|
||||
if ( info.m_mask & wxLIST_MASK_STATE )
|
||||
{
|
||||
lvItem.mask |= LVIF_STATE;
|
||||
// the other bits are hardly interesting anyhow
|
||||
lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
|
||||
}
|
||||
|
||||
bool success = ListView_GetItem((HWND)GetHWND(), &lvItem) != 0;
|
||||
if ( !success )
|
||||
{
|
||||
wxLogError(_("Couldn't retrieve information about list control item %d."),
|
||||
lvItem.iItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxConvertFromMSWListItem(this, info, lvItem);
|
||||
}
|
||||
|
||||
if (lvItem.pszText)
|
||||
delete[] lvItem.pszText;
|
||||
|
Reference in New Issue
Block a user