Re: Listview and Treeview
Matthew Lewis wrote:
> I've managed to get Treeview working (a bit ahead of schedule!).
Very slick, but (as you noted) pretty raw.
It might make sense to treat the listview and treeview as a collection of
controls, rather than as just data in a list. It might make it a lot easier
to change the text or graphic on an item, for example. I'll have to spend a
lot more time with the code - you've done a ton of work!
If would also be nice if the imagelist could be hidden entirely from the
user. The whole point of an imagelist is that the item will eventually be
attached to something. So it might be possible to hide the details with
something like this:
setImage( <id>, SM_CXICON )
Of course, I'd like to support BMP and XMP data as well, so:
setImageToIcon( <id>, SM_CXICON )
might be a better name. The routine could eventually be extended to work
with other controls, like menus, buttons and windows. It would be the job of
the routine to take care of all the gory details:
- if an image list of the proper dimensions doesn't exist, create one
- if the graphic is already loaded, use that pre-loaded one, otherwise:
- convert the graphic data to one the image list will accept
- add the graphic to the image list
- cache the graphic name, so it can be shared
- free memory
- attach the graphic to the requested control
It might even make sense to eventually deprecate setIcon and setBitmap and
replace them with setImageToIcon and setImageToBitmap.
-- David Cuny
|
Not Categorized, Please Help
|
|