This macro gives an example of how to create a number entry and how to update a label according to the changed value of this number entry.
private:
public:
~MyMainFrame() override;
void DoSetlabel();
};
{
fExit =
new TGTextButton(fHor1,
"&Exit",
"gApplication->Terminate(0)");
fNumber->Connect("ValueSet(Long_t)", "MyMainFrame", this, "DoSetlabel()");
(fNumber->GetNumberEntry())->Connect("ReturnPressed()", "MyMainFrame", this, "DoSetlabel()");
fLabel =
new TGLabel(fGframe,
"No input.");
SetWindowName("Number Entry");
Resize(GetDefaultSize());
MapWindow();
}
MyMainFrame::~MyMainFrame()
{
Cleanup();
}
void MyMainFrame::DoSetlabel()
{
fLabel->SetText(
Form(
"%ld", fNumber->GetNumberEntry()->GetIntNumber()));
fGframe->Layout();
}
{
new MyMainFrame(
gClient->GetRoot(), 50, 50);
}
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
The base class for composite widgets (menu bars, list boxes, etc.).
A composite frame with a border and a title.
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
TGNumberEntry is a number entry input widget with up/down buttons.
Yield an action as soon as it is clicked.
ROOT GUI Window base class.