Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

Setting selection for ListView

Started by Michael Bermel Oct 24, 2005 at 4:02 PM 8 replies 750+ views
Original Post
Michael Bermel
Michael Bermel
Hello everyone. I am trying to set the selection for a single-selection listview. I'm using this in combination with the LVS_SHOWSELALWAYS style. Witch message or macro should I use. To get the selection I use the ListView_GetSelectionMark macro. But the ListView_SetSelectionMark doesn't change the selection. Any advice is apreciated. Thank you.
Metro_Mystery
Metro_Mystery
Are you using MFC or the WindowsAPI?

If you're using MFC, the member function SetSel() of CListView takes care of that.
Michael Bermel
Michael Bermel
I'm using Win32 API. I looked up SetSel() in MSDN and CListView doesn't have it as a member.
Endurion
Endurion
You need to use ListView_SetItemState with the LVIS_SELECTED flag.

The ListView_SetSelectionMark is used for the anchor of a multiple selection and does not affect the selection state of that item.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.