ntupleTableTest.C: This TableTest class is a simple example of how to use a TGTable | Graphics User Interface | simpleTableTest.C: This TableTest class is a simple example of how to use a TGSimpleTable |
// // Author: Ilka Antcheva 1/12/2006 // 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. // To run it do either: // .x numberEntry.C // .x numberEntry.C++ #include <TApplication.h> #include <TGClient.h> #include <TGButton.h> #include <TGFrame.h> #include <TGLayout.h> #include <TGWindow.h> #include <TGLabel.h> #include <TGNumberEntry.h> #include <TString.h> class MyMainFrame : public TGMainFrame { private: TGCompositeFrame *fHor1; TGTextButton *fExit; TGGroupFrame *fGframe; TGNumberEntry *fNumber; TGLabel *fLabel; public: MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MyMainFrame(); void DoSetlabel(); ClassDef(MyMainFrame, 0) }; MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h) { fHor1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth); fExit = new TGTextButton(fHor1, "&Exit", "gApplication->Terminate(0)"); fHor1->AddFrame(fExit, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 4, 4, 4, 4)); AddFrame(fHor1,new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1)); fNumber = new TGNumberEntry(this, 0, 9,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99999); fNumber->Connect("ValueSet(Long_t)", "MyMainFrame", this, "DoSetlabel()"); (fNumber->GetNumberEntry())->Connect("ReturnPressed()", "MyMainFrame", this, "DoSetlabel()"); AddFrame(fNumber, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5)); fGframe = new TGGroupFrame(this, "Value"); fLabel = new TGLabel(fGframe, "No input."); fGframe->AddFrame(fLabel, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5)); AddFrame(fGframe, new TGLayoutHints(kLHintsExpandX, 2, 2, 1, 1)); SetCleanup(kDeepCleanup); SetWindowName("Number Entry"); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } MyMainFrame::~MyMainFrame() { // Destructor. Cleanup(); } void MyMainFrame::DoSetlabel() { // Slot method connected to the ValueSet(Long_t) signal. // It displays the value set in TGNumberEntry widget. fLabel->SetText(Form("%d",fNumber->GetNumberEntry()->GetIntNumber())); // Parent frame Layout() method will redraw the label showing the new value. fGframe->Layout(); } void numberEntry() { new MyMainFrame(gClient->GetRoot(), 50, 50); } numberEntry.C:1 numberEntry.C:2 numberEntry.C:3 numberEntry.C:4 numberEntry.C:5 numberEntry.C:6 numberEntry.C:7 numberEntry.C:8 numberEntry.C:9 numberEntry.C:10 numberEntry.C:11 numberEntry.C:12 numberEntry.C:13 numberEntry.C:14 numberEntry.C:15 numberEntry.C:16 numberEntry.C:17 numberEntry.C:18 numberEntry.C:19 numberEntry.C:20 numberEntry.C:21 numberEntry.C:22 numberEntry.C:23 numberEntry.C:24 numberEntry.C:25 numberEntry.C:26 numberEntry.C:27 numberEntry.C:28 numberEntry.C:29 numberEntry.C:30 numberEntry.C:31 numberEntry.C:32 numberEntry.C:33 numberEntry.C:34 numberEntry.C:35 numberEntry.C:36 numberEntry.C:37 numberEntry.C:38 numberEntry.C:39 numberEntry.C:40 numberEntry.C:41 numberEntry.C:42 numberEntry.C:43 numberEntry.C:44 numberEntry.C:45 numberEntry.C:46 numberEntry.C:47 numberEntry.C:48 numberEntry.C:49 numberEntry.C:50 numberEntry.C:51 numberEntry.C:52 numberEntry.C:53 numberEntry.C:54 numberEntry.C:55 numberEntry.C:56 numberEntry.C:57 numberEntry.C:58 numberEntry.C:59 numberEntry.C:60 numberEntry.C:61 numberEntry.C:62 numberEntry.C:63 numberEntry.C:64 numberEntry.C:65 numberEntry.C:66 numberEntry.C:67 numberEntry.C:68 numberEntry.C:69 numberEntry.C:70 numberEntry.C:71 numberEntry.C:72 numberEntry.C:73 numberEntry.C:74 numberEntry.C:75 numberEntry.C:76 numberEntry.C:77 numberEntry.C:78 numberEntry.C:79 numberEntry.C:80 numberEntry.C:81 numberEntry.C:82 numberEntry.C:83 numberEntry.C:84 numberEntry.C:85 numberEntry.C:86 numberEntry.C:87 numberEntry.C:88 numberEntry.C:89 |
|