Is it possible to change the text color of TGTab?

Hello ROOTers,
I would like to change the text color of a selected tab:

2021-01-28-112632_181x109_scrot

I would like to change text color on something light instead of the black one when it is selected. Is it possible?

P.S.
I used the TGTab::SetForegroundColor() member function but no success.


ROOT Version: 6.x
Platform: Linux, Ubuntu 18.04 or CentOS 7
Compiler: gcc 7.5.0 or gcc 4.8.5


if you take a look at the guitest.C tutorial, you can see:

   Pixel_t yellow;
   gClient->GetColorByName("yellow", yellow);
   TGTabElement *tabel = fTab->GetTabTab("Tab 3");
   tabel->ChangeBackground(yellow);

So you can do something like this (with the existing guitest.C code):

void TestDialog::DoTab(Int_t id)
{
   Pixel_t yellow;
   TGTabElement *tabel;
   static Int_t sel = -1;
   gClient->GetColorByName("yellow", yellow);
   if (sel >= 0) {
      tabel = fTab->GetTabTab(sel);
      tabel->ChangeBackground(fTab->GetDefaultFrameBackground());
   }
   tabel = fTab->GetTabTab(id);
   tabel->ChangeBackground(yellow);
   sel = id;
}

Ah, sorry, I thought that the term foreground was used for the font color. Question edited.

Oh, OK, sorry for the misunderstanding. and sorry, but I’m afraid there is no easy solution…

Thank you for reply. I’ll just choose some light color for the background for the active tab. No problem.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.