Toolbar menu for TCanvas


In my standalone C++ code I create TCanvas and TH2F objects in order to dispaly a 2 dimentional histogram. When I draw the histogram and the canvas using the Draw method, I don’t get any Toolbar menu, so I cannot edit, zoom etc.
I wonder which commands should I use in order to get these capabilities.



Add the following line in your macro:


(c1 is the canvas in which you want the tool bar)

[quote=“couet”]Add the following line in your macro:


(c1 is the canvas in which you want the tool bar)[/quote]

Since I use AtlasROOT, I get a compilation error - from some reason this function is missing. Any idea why ?

Seems to me this function is a standard one. It should be there in any ROOT version. I do not know what AtlasROOT is doing but seems to me this function should be in it. Can you send a little macro showing the problem ? what is the ROOT version ?

The code I use is:
h2 is my histogram and m_canvas is my canvas.


I get the following error:
/src/HoughDisplay.cxx:199: no matching function for call to `TCanvas::ToggleToolBar()’

I added these lines to my requirment file (it didn’t help):

use AtlasROOT AtlasROOT-* External
include_dirs "$(Hough_root)"
macro Hough_linkopts “-L$(Hough_root)/lib -lHough -lMinuit -lMatrix -lPhysics -lHistPainter -lHist -lRint -lGraf -lGraf3d -lGpad -lHtml -lPostscript -lGui -lGX11TTF -lGX11 -lpthread”

You can see the AtlasROOT description in this link : … AtlasROOT/



Hi Didi,

If you want to have the canvas toolbar visible any time you create a canvas, you can add the line:
Canvas.ShowToolBar: true
in the file .rootrc in your working directory.

Via the interpreter any time you can switch it ON/OFF using the command:

Cheers, Ilka

Hi Ilka !

I can’t find .rootrc file in my working directory. I use the Atlas environment, and the link to ROOT is done by adding use statement in the requirment file.
Where can I find this file ?



As Ilka said, this file should be created in your working directory (where you start root). If it doesn’t exist create it and put the line she told you in it.