Page 1 of 1

Rich List Control?

Posted: Fri Oct 02, 2009 5:45 am
by miclus
Is there a way to put images or multiple colors in a wxListCtrl row? Or maybe there is some other type of list control that allows this. I've seen programs where they have what look like normal lists, but somehow different colors throughout a row, with icons also. I was wanting to do the same thing. Here is an example:

Posted: Fri Oct 02, 2009 5:56 am
by van_user
Take a look at wxDataViewCtrl and its simplified versions.
(Sorry for my English).

Posted: Fri Oct 02, 2009 6:01 am
by miclus
Hmmm. I talked to the author, and he said he draws them on there manually. For instance, the smiley face with shades is the code B}. He said the B} is actually in the list, but he makes it show a smiley face in its place. Anyone know how you can draw things like that on the screen? I mean, do I have to somehow get the coordinates of the text in the window and then put a smiley face on top of it? I don't get how that works.

Posted: Fri Oct 02, 2009 6:08 am
by miclus
Basically, my issue is that I can do these things with a chat box, using a wxRichTextCtrl. But, there doesn't seem to be an analogous wxRichListCtrl. So, it looks like this drawing manually is the only way. But, I don't know how it work, for instance, how to get the exact location to draw something, how it remains in place when the list changes size, screen is resized, etc.

Posted: Fri Oct 02, 2009 6:36 am
by Jorg
I think the proper way to go is not looking for a rich list control, but for an owner drawn list control. It also means that you have to interpret the text yourself, and when it is a smiley figure, load it from a resource file/memory (look at portable pixmaps) and draw it on the canvas of the list control.

It is not so hard as it seems there are owner drawn examples in the wxWidgets library. It will also give you absolute freedom in what you can or cannot draw.

If you make it generic enough and use for example a semi-html syntax for your rich text listcrtrl, you could always contribute it back to wxWidgets I am sure a lot of people will appreciate that ..

With regards,
- jorgen