#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class MyMainFrame : public TGMainFrame { RQ_OBJECT("MyMainFrame") private: TGCompositeFrame *fDates; TGTextButton *fExit; TRootEmbeddedCanvas *fEcanvas; TGNumberEntry *neDateSt, *neDateEn; TGLabel *label1, *label2; public: MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h); virtual ~MyMainFrame(); void DoDraw(); void DoSetValue1(); void DoSetValue2(); ClassDef(MyMainFrame, 0); }; //Global Variables long date_st, date_en; //____________________________________________________________________________ MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h) { //Create a vertical frame widget with beginning / end buttons TGHorizontalFrame *fDates = new TGHorizontalFrame(this,200,600); AddFrame(fDates, new TGLayoutHints(kLHintsCenterX,2,2,2,2)); //Create Date Start button TGNumberEntry *neDateSt = new TGNumberEntry(fDates, 1, 8, 11, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 100); fDates->AddFrame(neDateSt, new TGLayoutHints(kLHintsLeft,5,5,3,3)); neDateSt->Connect("ValueSet(Long_t)", "MyMainFrame", this, "DoSetValue1()"); //Create Date End button TGNumberEntry *neDateEn = new TGNumberEntry(fDates, 20, 8, 21, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 100); fDates->AddFrame(neDateEn, new TGLayoutHints(kLHintsLeft,5,5,3,3)); cout<<"date_en = "<Connect("ValueSet(Long_t)", "MyMainFrame", this, "DoSetValue2()"); // Create PLOT SREM data button TGTextButton *plot_button = new TGTextButton(fDates,"&Plot SREM data"); plot_button->Connect("Clicked()","MyMainFrame",this,"DoDraw()"); fDates->AddFrame(plot_button, new TGLayoutHints(kLHintsCenterX,5,5,3,4)); // Create canvas widget fEcanvas = new TRootEmbeddedCanvas("Ecanvas",this,900,400); AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX| kLHintsExpandY, 10,10,10,1)); // Create a horizontal frame widget with buttons TGHorizontalFrame *hframe = new TGHorizontalFrame(this,900,600); TGTextButton *draw = new TGTextButton(hframe,"&Draw"); draw->Connect("Clicked()","MyMainFrame",this,"DoDraw()"); hframe->AddFrame(draw, new TGLayoutHints(kLHintsCenterX,5,5,3,4)); TGTextButton *exit = new TGTextButton(hframe,"&Exit", "gApplication->Terminate(0)"); hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX,5,5,3,4)); AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2)); // Set a name to the main frame SetWindowName("SREM data"); // Map all subwindows of main frame MapSubwindows(); // Initialize the layout algorithm Resize(this->GetDefaultSize()); SetCleanup(kDeepCleanup); // Map main frame MapWindow(); } //____________________________________________________________________________ void MyMainFrame::DoSetValue1() { date_st = neDateSt->GetNumberEntry()->GetIntNumber(); //date_st = 1; cout<<"\n\nDoSetValue1 is executed!!!!!!!!!!!!!!\n\n"; cout<<"date_st = "<GetNumberEntry()->GetIntNumber(); //date_en = 15; cout<<"\n\nDoSetValue2 is executed!!!!!!!!!!!!!!\n\n"; cout<<"date_en = "<SetFillColor(19); f1->SetFillStyle(1); f1->SetLineWidth(3); f1->Draw(); TCanvas *fCanvas = fEcanvas->GetCanvas(); fCanvas->cd(); fCanvas->Update(); } //____________________________________________________________________________ MyMainFrame::~MyMainFrame() { // Clean up used widgets: frames, buttons, layouthints Cleanup(); } //____________________________________________________________________________ void example_ex() { // Popup the GUI... new MyMainFrame(gClient->GetRoot(),1200,1000); }