I can not chang the background color of TGNumberEntry~

hello,recently I am working on the gui using ROOT and I want to chang the background color of the TGNumberEntry to give the user a notice.But I can’t do this in my code,the code is as follow

TGNumberEntry val = new TGNumberEntry(fGroupFrameSIPM_CAL, (Double_t) 0,6,-1,(TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1);
val->ChangeBackground(0xb3b3b3);

I could change the background color of TGNumberEntry in TGuiBuilder,but can’t do it in the code.

thanks for reading,happy weekend. :smiley:

Hi,

Here is the correct way:val->GetNumberEntry()->ChangeBackground(0xb3b3b3);I.e. change the background color of the “text entry” element of the number entry widget

Cheers, Bertrand.

[quote=“bellenot”]Hi,

Here is the correct way:val->GetNumberEntry()->ChangeBackground(0xb3b3b3);I.e. change the background color of the “text entry” element of the number entry widget

Cheers, Bertrand.[/quote]

:smiley: thank you.