Hello! I have made a separate post about this GUI before but since this is a different issue, I’ve made a new topic. I am trying to toggle the toolbar, editor, and event status bar in my GUI. I have had success getting the toolbar and the event status bar, but the editor does not seem to work properly for me. The space where the editor should appear (on the left of of the canvas) pops up, but no editor. I know that canv -> EditorBar();
works to get a pop-out editor bar, but I am trying to get it attached to the canvas and able to toggle on/off. Is there something I am missing in order to get the editor to appear properly?
viewhist::viewhist(const TGWindow *p, UInt_t w, UInt_t h)
{
fMain = new TGMainFrame(p,w,h);
//main canvas
TGHorizontalFrame *hframe0 = new TGHorizontalFrame(fMain,200,40);
//make it an embedded canvas
hframe0->SetEditable();
TCanvas *fEcanvas=new TCanvas("ECanvas","ECanvas",800,600);
hframe0->SetEditable(0);
fMain->AddFrame(hframe0, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10,1));
//get the histogram from the file
TFile *_file0 = TFile::Open("hgE.root");
if (_file0)
{
gE = (TH1D*)_file0->Get("gE");
if (!gE){ //to make sure file and hist exist
std::cout<<"no histogram found"<<std::endl;
}
}
else
std::cout<<"no file found"<<std::endl;
gE->SetDirectory(0);//detaches the histogram from the file, so we can close the file but still have gE
_file0->TFile::Close();
cgE=fEcanvas->GetCanvas();
cgE->SetTitle("Canvas gE");
cgE->ToggleEventStatus(); //Event Status Bar - this works
cgE->ToggleToolBar(); //Tool Bar - this works
cgE->ToggleEditor(); //Editor - this doesn't work
cgE->Draw();
gE->Draw();
//name the main frame
fMain->SetWindowName("Viewing hist - gE");
//Map all subwindows of the main frame
fMain->MapSubwindows();
//initialize the layout algorithm
fMain->Resize(fMain->GetDefaultSize());
//map main frame
fMain->MapWindow();
}
Thank you in advance!
ROOT Version: 6.14/06
Platform: CentOS Linux 7 (Core)
Compiler: g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)