TGComboBox symbols, colors in the entries

Hi,

I would like to use different colors (or symbols) in the entries. Is it possible?

for example and entry like:

Thanks in advance!

Hi,

There is no such option. But you can subclass TGLBEntry and create your own custom listbox entry (see for example TGLineLBEntry and TGIconLBEntry in TGListBox.h)

Cheers, Bertrand.

class TGIconLBEntry : public TGTextLBEntry

seems to be suitable to derive from or even to use it. Two questions I have in this case.

Looks like I need to use TGPicture.
The pictures/symbols are kept in the TGPicturePool.

How do I add a picture there? Can I do it on the fly, means generating it from let’s say a pad I’m drawing to?

Hi,

It can be any picture file (e.g. a png or jpg format), and on the fly too, for example, something like this:

TImage *img = TImage::Create(); // create an empty image img->FromPad(c1); // capture the canvas (could be gPad, or any other pad) img->Scale(16,16); // resize to create a smaller icon // now create a TGPicture from our image TGPicture *pic = gClient->GetPicturePool()->GetPicture("pic_name", img->GetPixmap(), img->GetMask());
Cheers, Bertrand.

Exactly what I needed. I’ll try out… Thanks!