24 class MyMainFrame :
public TGMainFrame {
27 TGCompositeFrame *fHor1;
29 TGGroupFrame *fGframe;
30 TGNumberEntry *fNumber;
34 MyMainFrame(
const TGWindow *p, UInt_t w, UInt_t h);
35 virtual ~MyMainFrame();
38 ClassDef(MyMainFrame, 0)
41 MyMainFrame::MyMainFrame(
const TGWindow *p, UInt_t w, UInt_t h)
42 : TGMainFrame(p, w, h)
45 fHor1 =
new TGHorizontalFrame(
this, 60, 20, kFixedWidth);
46 fExit =
new TGTextButton(fHor1,
"&Exit",
"gApplication->Terminate(0)");
47 fHor1->AddFrame(fExit,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
48 kLHintsExpandX, 4, 4, 4, 4));
49 AddFrame(fHor1,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1));
51 fNumber =
new TGNumberEntry(
this, 0, 9,999, TGNumberFormat::kNESInteger,
52 TGNumberFormat::kNEANonNegative,
53 TGNumberFormat::kNELLimitMinMax,
55 fNumber->Connect(
"ValueSet(Long_t)",
"MyMainFrame",
this,
"DoSetlabel()");
56 (fNumber->GetNumberEntry())->Connect(
"ReturnPressed()",
"MyMainFrame",
this,
58 AddFrame(fNumber,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
59 fGframe =
new TGGroupFrame(
this,
"Value");
60 fLabel =
new TGLabel(fGframe,
"No input.");
61 fGframe->AddFrame(fLabel,
new TGLayoutHints(kLHintsTop | kLHintsLeft,
63 AddFrame(fGframe,
new TGLayoutHints(kLHintsExpandX, 2, 2, 1, 1));
65 SetCleanup(kDeepCleanup);
66 SetWindowName(
"Number Entry");
68 Resize(GetDefaultSize());
72 MyMainFrame::~MyMainFrame()
79 void MyMainFrame::DoSetlabel()
84 fLabel->SetText(Form(
"%ld",fNumber->GetNumberEntry()->GetIntNumber()));
92 new MyMainFrame(gClient->GetRoot(), 50, 50);