|
-
March 5th, 2003, 01:16 PM
#1
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
-
March 5th, 2003, 01:23 PM
#2
Use LVN_ODSTATECHANGED instead of LVN_ITEMCHANGED, it will be called only once when a range of items change state.
-
March 5th, 2003, 01:52 PM
#3
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
-
March 5th, 2003, 05:04 PM
#4
LVN_ODSTATECHANGED
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
-
March 5th, 2003, 06:15 PM
#5
Em, sorry, not much time, will answer tomorrow, Guido
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|