Re: HOWTO TControlBar ?

Rene Brun (Rene.Brun@cern.ch)
Mon, 28 Apr 1997 11:29:13 +0200


Maarten Bruinsma wrote:
>
> Dear ROOT,
>
> I am making a controlbar in a program, but I don't know why the buttons
> do not appear.
> Do I have to give an additional command? This is what I have basically:
>
> TControlBar commandolijst("vertical", "Commando's");
> commandolijst.AddButton("Set Input File", "SetInputFile()", "Give name
> of file to process");
> commandolijst.AddSeparator();
> commandolijst.AddButton("Calculate Efficiency" ,
> "EfficiencyDetermination()", "Determine efficiency");
> commandolijst.AddButton("Calculate Resolution",
> "ResolutionDetermination()","Determine resolution");
>
> commandolijst.Show();
>
> And for later: How exactly do I tell it what to do if the button is
> pressed. Do I have to give "MyRoutine()" as a second argument to
> AddButton?

In the tutorials, we have an example (demos.C) showing how to use
a TControlBar. Here is the code of this example.

Rene Brun

========================demos.C====================================
{
//
// This macro generates a Controlbar menu: To see the output, click
begin_html <a href="gif/demos.gif" >here</a> end_html
// To execute an item, click with the left mouse button.
// To see the HELP of a button, click on the right mouse button.

gROOT->Reset("a");
bar = new TControlBar("vertical");

bar->AddButton("Help to run demos",".x demoshelp.C", " ");
bar->AddButton("browser", "{b = new TBrowser("Browser");}",
"Start the ROOT Browser");
bar->AddButton("framework", ".x framework.C", "An Example of Object
Oriented User Interface");
bar->AddButton("first", ".x first.C", "An Example of slide
with Root");
bar->AddButton("hsimple", ".x hsimple.C", "An Example Creating
Histograms/Ntuples on File");
bar->AddButton("hsum", ".x hsum.C", "Filling histograms
and some graphics options");
bar->AddButton("formula1", ".x formula1.C", "Simple Formula and
Functions");
bar->AddButton("surfaces", ".x surfaces.C", "Surface Drawing
options");
bar->AddButton("fillrandom", ".x fillrandom.C","Histograms with
Random Numbers from a Function");
bar->AddButton("fit1", ".x fit1.C", "A Simple Fitting
Example");
bar->AddButton("multifit", ".x multifit.C", "Fitting in subranges
of histograms");
bar->AddButton("h1draw", ".x h1draw.C", "Drawing Options for
1D Histograms");
bar->AddButton("graph", ".x graph.C", "Example of a simple
graph");
bar->AddButton("gerrors", ".x gerrors.C", "Example of a graph
with error bars");
bar->AddButton("tornado", ".x tornado.C", "Examples of 3-D
PolyMarkers");
bar->AddButton("shapes", ".x shapes.C", "The Geometry
Shapes");
bar->AddButton("geometry", ".x geometry.C", "Creation of the NA49
geometry file");
bar->AddButton("na49view", ".x na49view.C", "Two views of the
NA49 detector geometry");
bar->AddButton("file", ".x file.C", "The ROOT file
format");
bar->AddButton("fildir", ".x fildir.C", "The ROOT file,
directories and keys");
bar->AddButton("tree", ".x tree.C", "The Tree Data
Structure");
bar->AddButton("ntuple1", ".x ntuple1.C", "Ntuples and
Selections");
bar->AddButton("rootmarks", ".x rootmarks.C", "Prints an estimated
ROOTMARKS for your machine");
bar->Show();
gROOT->SaveContext();
}