Turning menu bar on/off on TCanvas


_ROOT Version:6.12/08
_Platform:fedora 27
_Compiler:


Dear co-rooters,

I am facing a rather strange issue.
I was given a root file that contains a couple of TTrees and a couple of TCanvas objects.

When I get the a TCanvas from the file using file->GetObject("Canvas;1", c1) and try to draw c1 using c1->Draw() the TCanvas really pops-out but the menu bar is not there!

I tried getting it by using GetEditorBar() but in didn’t work.
Any idea on how to get the menu back to use the editor?

Thanks in advance!


The exact procedure I followed was

root [0] TFile *_file0 = TFile::Open(“FIMG-6_201000-1-s1_1-100.root”)
root [1] TCanvas *c1;
root [2] _file0->GetObject(“Canvas;1”, c1)
root [3] c1->Draw()

The file can be found here

Yes your canvas does not have the menus. When you saved it did it have them ?

Try:

((TRootCanvas *)c1->GetCanvasImp())->ShowMenuBar();
((TRootCanvas *)c1->GetCanvasImp())->ShowToolBar();
((TRootCanvas *)c1->GetCanvasImp())->ShowStatusBar();

Cheers, Bertrand

1 Like

I was given this file, as it was uploaded so I don’t really know how it was produced.

Thank you so much!!!
It really worked!

1 Like

FYI, in this TCanvas constructor, you can see that:
wtopx,wtopy are the pixel coordinates of the top left corner of the canvas (if wtopx < 0) the menubar is not shown)

Cheers, Bertrand.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.