Re: HOWTO TControlBar ?

Maarten Bruinsma (t26@hp.nikhef.nl)
Mon, 28 Apr 1997 12:53:16 +0200 (MET DST)


Hi, here is my main program:

/// nodig voor ROOT:
extern void InitGui();
VoidFuncPtr_t initfuncts[] = { InitGui, 0 };
int Error;
TROOT mijnroot("mijn wortel", "Canvas scherm", initfuncts);

TApplication *theApp;
TCanvas *plotcanvas;

ifstream input_file;
///tracks for offset determination
Track* min_tracks;
///number of tracks to be user for offsetdetermination
Int_t nr_of_min_tracks;

int main(int argc, char **argv)
{
// First create application environment. If you replace TApplication
// by TRint (which inherits from TApplication) you will be able
// to execute CINT commands once in the eventloop (via Run()).
Track testtrack;
theApp = new TApplication("App",&argc,argv);

input_file.open("translated.racks");

TControlBar *commandolijst = new TControlBar("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();
getchar();

plotcanvas = new TCanvas("Picture", "The Alignment Geometry",
400,400,400,400);
plotcanvas->Show();

/// vul cell met de plaats etc van de draden.
SetGeometry();
/// dit gaat dus fout:
testtrack.CreateSimulatedR(1,0.0001); /* eff, noise*/

// testtrack.LoadNextFromFile();
testtrack.TrackFitUser();
testtrack.Plot_On_Screen();

return(0);
}

Maybe the problem is that I have another canvas also? I don't know, I am
quite new to ROOT.

Thanks.
Maarten.

On Mon, 28 Apr 1997, Nenad Buncic wrote:

> On Mon, 28 Apr 1997, Maarten Bruinsma wrote:
>
> > 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?
>
> No you don't have to give an additional command, you are
> doing just fine. I've tried your example running interactively
> and it works fine.
> It's very likely that your problem is somewhere else
> in your code, so could you send us at least your 'main' program.
>
> > 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?
>
> The second parameter is exact command as you type it
> from the command line interface (interpreter), i.e:
> ".x hello.cxx"
> ".q"
> "int f = calc()"
>
>
> -------------------------------------------------------
> Nenad BUNCIC email: Nenad.Buncic@cern.ch
> CERN, PPE Division/NA49 phone: (+41.22.76)76462,
> CH-1211 Geneva 23 (+41.22.76)74921
> SWITZERLAND fax: (+41.22.76)77910
> -------------------------------------------------------
>
>