Re: [ROOT] array of TButton in a function (fwd)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Mar 03 2003 - 15:24:28 MET


Hi,

Replace line
     for (icount = 0; icount < 20; icount++)
by
     for (icount = 0; icount < 20; icount++) {

Rene Brun

On Mon, 3 Mar 2003, 
Golovanov 
George wrote:

> 
> 
> Hi ROOTers,
>  
> I want to create an array of TButton in a function:
> 
>   void Test() {
>     Int_t icount, jcount;
>     TButton *but[20][20]; 
> 
>     for (icount = 0; icount < 20; icount++)
>       for (jcount = 0; jcount < 20; jcount++){
> 
>         but[icount][jcount] = new TButton("","",x1,y1,x2,y2);
>         but[icount][jcount]->Draw(); 
>     } 
>   }
> 
> I get:
> 
>   Error: Non-static-const variable in array dimension FILE:SimGui.C 
>   LINE:553 (cint allows this only in interactive command and special form 
>   macro which is special extension. It is not allowed in source code. 
>   Please ignore subsequent errors.)
> 
> But when I try to call same code from a macros all work succefully.
> Thanks for any help,
> 		     George.
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET