I know this is possible in X, but don’t know if it is possible in root.
Is it possible to construct a widget, say a TGlabel, that is used in a dialog but not visible until other events occur?
EG: I create a label that is not initially used until I enable it through a checkbox.
I can imagine creating it on check, and deleting it on uncheck. Is it possible to do this a different way?
You can hide and show widgets via their parent frame by using HideFrame(myFrame) or ShowFrame(myFrame) methods of TGCompositeFrame class. It is important to call HideFrame only after the all widgets have been laid out and the sub windows of the composite frame have been mapped via method MapSubwindows(), i.e:
frame->MapSubwindows(); // maps subwindows of 'frame'
frame->HideFrame(hFrame2); // hides hFrame2
frame->MapWindow(); // maps 'frame'
The state information can be obtained from the methods GetState(myFrame), IsVisible(myFrame), etc.
For a TGLabel widget you may use the methods
label->Enable();to set its different state.
I forgot to mention the macro $ROOTSYS/tutorials/gui/guilabels.C as an example for enabled/disabled labels. It is available in ROOT v5.14.