Hi ROOTers
I am trying to implement the action of clicking at the corner of the window - the “x” button to close my application. I reviewed the chapter 25 of the ROOT documentation “Writing a Graphical User Interface” but I could not find any information about this. How could I implement it?
This is my relevant code:
MainFrame::MainFrame(const TGWindow *p,UInt_t w,UInt_t h,int argc, char **argv) : TGMainFrame(p,w,h) {
// Creates widgets of the example
fEcanvas = new TRootEmbeddedCanvas (“Ecanvas”,this,200,200);
AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
10,10,10,1));
TGHorizontalFrame *hframe=new TGHorizontalFrame(this, 200,40);
TGTextButton *draw = new TGTextButton(hframe,"&Draw");
draw->Connect(“Clicked()”,“MainFrame”,this,“Test()”);
hframe->AddFrame(draw, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
TGTextButton *exit = new TGTextButton(hframe,"&Exit ",
“gApplication->Terminate()”);
hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
AddFrame(hframe,new TGLayoutHints(kLHintsCenterX,2,2,2,2));
// Sets window name and shows the main frame
SetWindowName(“Simple Example”);
MapSubwindows();
Resize(GetDefaultSize());
MapWindow();
PMT_Analyze(argc,argv);
}
Thank you,
Cristian