TGListTreeItem::SetColor : does it work?

Dear all,

I would like to have color background for tree’s item. I see a method called “SetColor” in TGListTreeItem(Std) and try to use it but without any success so far.

TGListTreeItem* current = fListTree->GetFirstItem(); const TGPicture *pic = 0; GetObjPicture(&pic); current->SetPictures(pic, pic); current->SetColor(kRed); cout << "color : " << current->GetColor() << endl; // returns 632 -> ok fListTree->ClearViewPort();

With the above code the icon change but not the color.

Do I missinterpret the method SetColor() ?
Or do I do something wrong ?
Thanks in advance,

Hi Barth,

The color is used with the list tree color mode: enum EColorMarkupMode { kDefault = 0, kColorUnderline = BIT(0), kColorBox = BIT(1) };
which can be a color box, an underline, or both. There is actually no method to change the background color of a specific list tree item.

Cheers, Bertrand.

Hi Bertrand,

Thanks for the very quick answer. The color box is enough for what I want to do. However, am I right saying that only the leaves get the color box ? Would be nice to have it too for them…


Forget what I said :slight_smile:
The folders can have a box as well.