Re: TControlBar

Rene Brun (Rene.Brun@cern.ch)
Thu, 16 Apr 1998 16:59:29 +0200


rene Scholte wrote:
>
> Hello ROOTers,
>
> I've made a very simple controlbar with one button which calls a very
> simple macro when you press it .
> this is the controlbar-macro :
>
> {
> gROOT->LoadMacro("exp.c");
> bar = new TControlBar("vertical", "Demos");
>
> bar->AddButton("exp",".x exp.c","alkjdsn");
> bar->Show();
> gROOT->SaveContext();
> }
>
> and this is exp.c :
>
> { #include <iostream.h>
>
> gROOT.Reset();
> Int_t nr;
> Int_t nrb;
> Int_t nrc;
> cout << "give a number : ";
> cin >> nr;
> cout << "number 1 is : " << nr << endl;
> cout << "give another number : ";
> cin >> nrb;
> cout << "number 2 is : " << nrb << endl;
> }
>
> There is a problem. If a run the macro from the controlbar the second
> number isn't stored right. If I run exp.c from the command line, everything
> works fine.
> What am i missing here ?
>
> output from ROOT :
>
> root [0] .x barexp.c
> root [1] Warning: File "iostream.h" already loaded
> give a number : 34
> number 1 is : 34
> give another number : 45
> number 2 is : 5
>
> (int)4
> root [2] Warning: File "iostream.h" already loaded
> give a number : 345
> number 1 is : 345
> give another number : 346
> number 2 is : 46
>
> (int)3
> root [3] .x exp.c
> Warning: File "iostream.h" already loaded
> give a number : 345
> number 1 is : 345
> give another number : 346
> number 2 is : 346
> root [4]
>
> at root[1] and root[2] I execute exp.c from the controlbar, at root[3] I
> execute exp.c from the command line.

Sorry, I lost this mail two weeks ago.
I cannot reproduce your problem (apparently due to cout!!).
However, I am running with root 2.00/04 and something was fixed
by Masa in cout in this release.

Rene Brun