Editor not appearing in GUI canvas

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 
  TCanvas *fEcanvas=new TCanvas("ECanvas","ECanvas",800,600);
  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;
      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

  cgE->SetTitle("Canvas gE");
  cgE->ToggleEventStatus(); //Event Status Bar - this works
  cgE->ToggleToolBar(); //Tool Bar - this works
  cgE->ToggleEditor(); //Editor - this doesn't work

  //name the main frame
  fMain->SetWindowName("Viewing hist - gE");
  //Map all subwindows of the main frame
  //initialize the layout algorithm
  //map main frame

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)

I think this is a conceptual problem. In TCanvas (well, in fact in TRootCanvas), we check if the parent is the default root (desktop) and if not, we check if the parent is the ROOT browser, and if so we embed the editor in its left tab container. But if the parent is not the desktop and not the ROOT browser, nothing happens. I think that could be easily fixed. I’ll check and let you know

1 Like

FYI, there is now the PR #12477 for this issue

1 Like

Hi @mberube,

FYI, this is now fixed by the commit #77d0a995

Cheers, Bertrand.

Awesome, thank you!

1 Like