Henkie
February 23rd, 2007, 06:33 PM
I'm trying to select an item in a listview from code. However I'm having some problems. Both
ListView_SetItemState(ListViewHandle, 4, LVIS_SELECTED, LVIS_SELECTED)andSelectListViewItemMessage.state = LVIS_SELECTED;
SelectListViewItemMessage.stateMask = LVIS_SELECTED;
SendMessage(ListViewHandle, LVM_SETITEMSTATE, (int) 4, (LPARAM) &SelectListViewItemMessage);don't work. However sendmessage does return TRUE.
Mayb it is due to the style of the listview? It has the following style (there is always only 1 item selected never 0 never more than 1):
WS_CHILD LVS_REPORT
WS_VISIBLE LVS_SINGLESEL
WS_VSCROLL LVS_SHOWSELALWAYS
WS_TABSTOP LVS_SHAREIMAGELISTS
LVS_OWNERDRAWFIXED
LVS_NOCOLUMHEADER
ExStyle: 0x0
ListView_SetItemState(ListViewHandle, 4, LVIS_SELECTED, LVIS_SELECTED)andSelectListViewItemMessage.state = LVIS_SELECTED;
SelectListViewItemMessage.stateMask = LVIS_SELECTED;
SendMessage(ListViewHandle, LVM_SETITEMSTATE, (int) 4, (LPARAM) &SelectListViewItemMessage);don't work. However sendmessage does return TRUE.
Mayb it is due to the style of the listview? It has the following style (there is always only 1 item selected never 0 never more than 1):
WS_CHILD LVS_REPORT
WS_VISIBLE LVS_SINGLESEL
WS_VSCROLL LVS_SHOWSELALWAYS
WS_TABSTOP LVS_SHAREIMAGELISTS
LVS_OWNERDRAWFIXED
LVS_NOCOLUMHEADER
ExStyle: 0x0