Re: CListCtrl size at runtime
Interesting point about the autosizing thing. I'd never noticed that since
I don't use that feature, but I can see how the list wouldn't know about the
size of the data without displaying it. I also agree about the item data.
No real need for that any more since you can store anything in your own
data. One nice artifact is you can also modify the data being displayed in
a row based on run time criteria and not have to remove and add back the
row. You can display any text at all based on flags you may have set and
that's a nice feature.
I use SetItemCountEx() to trick the list into thinking it has the number of
items in it rather than going to the trouble of setting up LVITEMS with the
callback. It just seems a lot easier and faster to set up and you get the
same effect. I'm guessing that item data must be stored somewhere in the
control as well, but I don't know for sure.
Tom
"David Connet" <stuff@agilityrecordbook.com> wrote in message
news:lofVk.738$jZ1.318@flpi144.ffdc.sbc.com...
"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> wrote in
news:eX7XVPpSJHA.1184@TK2MSFTNGP03.phx.gbl:
"Tom Serface" <tom.nospam@camaswood.com> ha scritto nel messaggio
news:02461D6B-4548-4346-BCA1-CD1852FF8979@microsoft.com...
It can easily be done with MFC now :o)
I think not.
I was just playing with virtual lists and discovered some interesting
(subtle) UI things... I already use getdispinfo (insert object into data
item, so the list is keeping my objects, rather than me).
Development
- have to delete all calls to listctrl.SortItems (it'll assert, for my
tests, I just ignored the assert - and ignored the fact that it didn't
sort)
- don't use listctrl.GetItemData - replace with direct access to your
data store (didn't even think of that at first - until I ran the program
and crashed!)
Use
- autosizing of columns only works on the visible rows. This makes it
interesting when you add 1000 items then scroll - and see "..." after a
bunch of things. (at first I thought I'd broken something - then I
realized what had happened)
- selection (and multiple selection) just works. That was a pleasant
surprise.
I didn't go any further than that (for instance, dealing with state). But
it did show me that while virtual lists definitely have their use, their
behavior is different.
Dave Connet