Getting a selected item in a List Control, changing subitems

2.7k views Asked by At

How can I catch a click on an item, and then change all it's subitems states?

enter image description here

I know I can get the selected item with GetFirstSelectedItemPosition, but how do I use the SetItemState on the given position?

EDIT: I was basically looking for this: m_ListControl.SetExtendedStyle(LVS_EX_FULLROWSELECT)

1

There are 1 answers

4
Superman On

Create a notification handler for the LVN_ITEMCHANGED notification. This handler will be called whenever a new item has been selected either using the mouse or the keyboard. If you particularly need to handle mouse clicks, create a notification handler for the NM_CLICK notification instead.

Both event handlers' LPARAM parameter points to a structure that contains a member called iItem. This is the index to the item just selected or clicked. Use this iItem as the first parameter to the SetItemState method.