I have a program system with a main program that calls lots of forms.
In the main program I define an array gaAccess as public

In some of the forms I reference the array in the refresh method of
some of the buttons.

external array gaAccess
this.enabled = gaAccess[2] != 'R'

I have also put the external array command in the load event.

when I build the project I am still getting the undefined error and
would like to clean them up. What am I doing wrong????


czeb

Re: External array not working - VFP 9 sp2 by Bernhard

Bernhard
Fri Mar 30 13:54:30 CDT 2007

Hi Jim

> I have a program system with a main program that calls lots of forms.
> In the main program I define an array gaAccess as public
>
> In some of the forms I reference the array in the refresh method of
> some of the buttons.
>
> external array gaAccess
> this.enabled = gaAccess[2] != 'R'
>
> I have also put the external array command in the load event.
>
> when I build the project I am still getting the undefined error and
> would like to clean them up. What am I doing wrong????

First of all: the warning is a warning only from the project manager. At
runtime, your program will work without any problems.

To advice the project manager, put EXTERNAL ARRAY gaAccess in _every_ method and
program, that uses this array. It has no effect at all if you put this command
in other methods.
If it does not help, then you may add these 3 lines to every method that uses
the array:
IF .F.
DIMENSION gaAccess(1)
ENDIF
Put it anywhere in the method, it can also be after a final RETURN.
Since it is only a hint for the project manager, the DIMENSION line should be
placed so that it does not affect at run time.

Regards
Bernhard Sander

Re: External array not working - VFP 9 sp2 by Cy

Cy
Sat Mar 31 19:32:57 CDT 2007

In addition, VFP9 SP2 is as far as I know, not yet released. The
product that can be downloaded is a CTP which is a Community Technology
Preview, meaning it's something to look at to get an idea of what the
final release may look like, but is not intended for use in an actual
development environment.

Cy Welch
Senior Programmer
MetSYS Inc
http://www.metsysinc.com


Bernhard Sander wrote:
> Hi Jim
>
>> I have a program system with a main program that calls lots of forms.
>> In the main program I define an array gaAccess as public
>>
>> In some of the forms I reference the array in the refresh method of
>> some of the buttons.
>>
>> external array gaAccess
>> this.enabled = gaAccess[2] != 'R'
>>
>> I have also put the external array command in the load event.
>>
>> when I build the project I am still getting the undefined error and
>> would like to clean them up. What am I doing wrong????
>
> First of all: the warning is a warning only from the project manager. At
> runtime, your program will work without any problems.
>
> To advice the project manager, put EXTERNAL ARRAY gaAccess in _every_
> method and program, that uses this array. It has no effect at all if you
> put this command in other methods.
> If it does not help, then you may add these 3 lines to every method that
> uses the array:
> IF .F.
> DIMENSION gaAccess(1)
> ENDIF
> Put it anywhere in the method, it can also be after a final RETURN.
> Since it is only a hint for the project manager, the DIMENSION line
> should be placed so that it does not affect at run time.
>
> Regards
> Bernhard Sander

Re: External array not working - VFP 9 sp2 by Jim

Jim
Mon Apr 02 07:16:44 CDT 2007

Bernard, the code below inserted into each method referencing the
array did the trick.
Still not sure why all of the other approaches failed.
Thanks.
> IF .F.
> DIMENSION gaAccess(1)
> ENDIF



Re: External array not working - VFP 9 sp2 by Craig

Craig
Mon Apr 02 10:16:37 CDT 2007

Better than EXTERNAL....

At the end of your Main.prg, add the following:

PROCEDURE Dummy
PUBLIC gaAccess[1]


Do not add a call to Dummy. It's purpose is to stop the compiler from
complaining.



FYI, SP2 has not been released and should be be used in production.

--
----
Craig Berntson
MCSD, Visual FoxPro MVP
Salt Lake City Fox User Group
"Jim Czeb" <james.czebiniak@pearlcarroll.com> wrote in message
news:1175274979.056866.24720@r56g2000hsd.googlegroups.com...
>I have a program system with a main program that calls lots of forms.
> In the main program I define an array gaAccess as public
>
> In some of the forms I reference the array in the refresh method of
> some of the buttons.
>
> external array gaAccess
> this.enabled = gaAccess[2] != 'R'
>
> I have also put the external array command in the load event.
>
> when I build the project I am still getting the undefined error and
> would like to clean them up. What am I doing wrong????
>
>
> czeb
>



Re: External array not working - VFP 9 sp2 by Jim

Jim
Tue Apr 03 06:33:59 CDT 2007

On Apr 2, 11:16 am, "Craig Berntson" <c...@craigberntson.com> wrote:
> Better than EXTERNAL....
>
> At the end of your Main.prg, add the following:
>
> PROCEDURE Dummy
> PUBLIC gaAccess[1]
>
> Do not add a call to Dummy. It's purpose is to stop the compiler from
> complaining.
>
> FYI, SP2 has not been released and should be be used in production.
>
> --
> ----
> Craig Berntson
> MCSD, Visual FoxPro MVP
> Salt Lake City Fox User Group"Jim Czeb" <james.czebin...@pearlcarroll.com> wrote in message
>
> the dummy procedure is the first thing I tired and that didn't work. Actually, the gaAccess array is defined in the main program and is global to the whole system. That was why I was so frustrated with it.
By the way I am running SP1!!!!!


Re: External array not working - VFP 9 sp2 by Bernhard

Bernhard
Tue Apr 03 07:41:44 CDT 2007

Hi Jim,

>>Better than EXTERNAL....
>>
>>At the end of your Main.prg, add the following:
>>
>>PROCEDURE Dummy
>>PUBLIC gaAccess[1]
>>
>>Do not add a call to Dummy. It's purpose is to stop the compiler from
>>complaining.
>>
>>FYI, SP2 has not been released and should be be used in production.
>>
>>--
>>----
>>Craig Berntson
>>MCSD, Visual FoxPro MVP
>>Salt Lake City Fox User Group"Jim Czeb" <james.czebin...@pearlcarroll.com> wrote in message
>>
>>the dummy procedure is the first thing I tired and that didn't work. Actually, the gaAccess array is defined in the main program and is global to the whole system. That was why I was so frustrated with it.
>
> By the way I am running SP1!!!!!

Problem is: it is not enough to announce EXTERNAL ARRAY in some main program.
The project manager wants to see such declaration in every program, where it is
ambigous whether it is an array or a function call.
It is an old problem since the dos days of foxpro.
The idea of Craig with Procedure Dummy will not work in method code snippets,
since there it is not allowed to define a procedure.

Regards
Bernhard Sander

Re: External array not working - VFP 9 sp2 by Craig

Craig
Tue Apr 03 09:51:28 CDT 2007

Actually, it does work because the array is declared PUBLIC.

--
----
Craig Berntson
MCSD, Visual FoxPro MVP
Salt Lake City Fox User Group
"Bernhard Sander" <fuchs@no.spam> wrote in message
news:uEFZx1edHHA.2332@TK2MSFTNGP04.phx.gbl...

> Problem is: it is not enough to announce EXTERNAL ARRAY in some main
> program. The project manager wants to see such declaration in every
> program, where it is ambigous whether it is an array or a function call.
> It is an old problem since the dos days of foxpro.
> The idea of Craig with Procedure Dummy will not work in method code
> snippets, since there it is not allowed to define a procedure.
>
> Regards
> Bernhard Sander



Re: External array not working - VFP 9 sp2 by Cy

Cy
Tue Apr 03 14:16:28 CDT 2007

It's also possible that the dummy function works fine in SP1 but not
currently in SP2 since SP2 is not finished yet. It could be a bug in
SP2 CTP.

Cy Welch
Senior Programmer
MetSYS Inc
http://www.metsysinc.com


Craig Berntson wrote:
> Actually, it does work because the array is declared PUBLIC.
>