CListCtrl multiple selection - a strange problem

Hi,

I have a CListCtrl inside a dialog. Each item in the list represents data about a particular person. Related to each person are a number of data files. What I am wanting to do is display the size of each person's data files (and the total size of all people's files) in the caption at the top of the dialog (ie: Using SetWindowText).

Ok - so I have it working fine for the total files and partially working for the individual files. My problem is how to correctly capture the changes in selection on the list control. I am using the NM_CLICK (ie: OnClick...) and LVN_KEYDOWN notifications to recalculate the size when someone either clicks on another person or moves with the arrow or page up/page down keys. I need to use these notifications rather than LVN_ITEMCHANGED as this one was updating the size for every item in the selection rather than at the end of a multiple selection.

I have trouble when I try and capture multiple selection using the page up/page down keys - I cannot work out how to catch the windows message at the right time... it will not show the correct total until I move to the next person. ie: I select a number of items in the list and the total is not correct until I move the arrow key up or down. Does this make sense? Can anyone help with this very annoying, but small issue? Also - if there is some easier or better way to do this please let me know ...

thank you,
em

ps: I can provide more info if needed
[1514 byte] By [Emster] at [2007-11-18 3:13:15]
# 1 Re: CListCtrl multiple selection - a strange problem
Use LVN_ODSTATECHANGED instead of LVN_ITEMCHANGED, it will be called only once when a range of items change state.
gstercken at 2007-11-11 3:46:40 >
# 2 Re: CListCtrl multiple selection - a strange problem
Thanks for the reply. The idea sounds good, but when I tried to use it previously nothing happened at all. Is there anything extra about LVN_ODSTATECHANGED that I need to know?

thanks again,
Em
Emster at 2007-11-11 3:47:40 >
# 3 Re: CListCtrl multiple selection - a strange problem
OK I have looked further into LVN_ODSTATECHANGED and it seems that it will only work when you use the LVS_OWNERDATA style for the list control. I am not using this, so was wondering if anyone knows of any alternatives... (or could tell me why I should use it??) It seems like such a simple thing to accomplish, yet I have tried many different ways of doing it and have not yet come up with something that works for all scenarios (ie: single mouse click, arrow move, multiple mouse selection, multiple arrow/page up/down selection etc).

any help would be appreciated,
thanks
em
Emster at 2007-11-11 3:48:36 >
# 4 Re: CListCtrl multiple selection - a strange problem
Em, sorry, not much time, will answer tomorrow, Guido
gstercken at 2007-11-11 3:49:41 >