Re: [ROOT] TButton, static variable

From: Valeri Fine (fine@bnl.gov)
Date: Sat May 19 2001 - 22:03:07 MEST


Hello, Dmitri


Do you really  want each time one presses the button a brand new version of
 your macro to be loaded.

Please try:

root[].L nnn.C
root[] TButton *b = new TButton("Summary","nnn(1,2);",0.1,0.8,0.3,0.9);

 This should work as expected.

               Valeri
>
> Hi ROOTers,
>
> I create the TButton object by
> TButton *b = new TButton("Summary","gROOT->ProcessLine(\".x
nnn.C(1,2)\");",0.1,0.8,0.3,0.9);
>
> and define in "nnn.C" script static variable "count":
>
> nnn.C(Int_t, Int_t)
> {
>   static Int_t count = 0;
>   cout << "count =" << ++count << endl;
>
> [... omitted ...]
> }
>
> Pressing on the button "b" I get "count = 0" (zero) everytime.
> But when I call nnn.C from command line:
> root [] .x nnn.C(1,2)
> root [] .x nnn.C(2,2)
>
> I receive "1", "2" values for count.
>
> Why "count" does not work properly in first case (through the button)?
>
>
>  - Dmitriy -
>
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:46 MET