Issue in TGFrame::SetBackgroundColor(Pixel_t back)

Hi.
This simple snipped code shows a black widget in place of a white one .

TGNumberEntryField *fBaF1NumberEntry1 = new TGNumberEntryField(fHorizontalFrame3,-1,0,TGNumberEntry::EStyle::kNESInteger);
fBaF1NumberEntry1->SetBackgroundColor(kWhite);

kWhite is in Rtypes.h from here

enum EColor { kWhite =0,   kBlack =1,   kGray=920,
              kRed   =632, kGreen =416, kBlue=600, kYellow=400, kMagenta=616, kCyan=432,
              kOrange=800, kSpring=820, kTeal=840, kAzure =860, kViolet =880, kPink=900 };

what’s wrong?

Thanks for help, Bruno


_ROOT Version: 6.12.06
_Platform: Ubuntu
Compiler: Not Provided


Hi,

According to the SetBackgroundColor() class reference, you must pass a Pixel_t value. So try with fBaF1NumberEntry1->SetBackgroundColor((Pixel_t)0xffffff);

Cheers, Bertrand.

Ok, perfect, thank you. Now it works.
But where can I find the right number for differents colors?
For example, red?

Cheers, Bruno

It’s a regular RGB hexadecimal coding: 0xRRGGBB

Oh, good, now I understand, thank you

And you can also use the TColor methods

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