diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index f2cb4e3b38..b94db2a626 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -727,7 +727,11 @@ bool wxListCtrl::GetItem(wxListItem& info) const lvItem.iItem = info.m_itemId; lvItem.iSubItem = info.m_col; - if ( info.m_mask & wxLIST_MASK_TEXT ) + // If no mask is specified, get everything: this is compatible with the + // generic version and conforms to the principle of least surprise. + const long mask = info.m_mask ? info.m_mask : -1; + + if ( mask & wxLIST_MASK_TEXT ) { lvItem.mask |= LVIF_TEXT; lvItem.pszText = new wxChar[513]; @@ -738,13 +742,13 @@ bool wxListCtrl::GetItem(wxListItem& info) const lvItem.pszText = NULL; } - if (info.m_mask & wxLIST_MASK_DATA) + if ( mask & wxLIST_MASK_DATA ) lvItem.mask |= LVIF_PARAM; - if (info.m_mask & wxLIST_MASK_IMAGE) + if ( mask & wxLIST_MASK_IMAGE ) lvItem.mask |= LVIF_IMAGE; - if ( info.m_mask & wxLIST_MASK_STATE ) + if ( mask & wxLIST_MASK_STATE ) { lvItem.mask |= LVIF_STATE; wxConvertToMSWFlags(0, info.m_stateMask, lvItem);