Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>>whats the difference, then, between a PRIVATE variable that is available to the whole application by being declared in the startup and a PUBLIC variable declared later?
>
>Private variables go away when the routine that creates them ends, publics don't go away until VFP quits or they are released using the release command.
>
>Public variables can interfere with other routines. In COM objects they can, under certain conditions, interfere with other COM server instances.
>
>Another difference, if you are distributing a system that is contained in multiple APP files, each app file can have its own set of privates. If an app declared a var public that already existedf in another routine, you would get and error.
>
so if we're running a standalone application (and only then) it doesn't really matter which you use because as soon as you leave the app, all variables will be released anyway...
>>indeed, in fact, what I have been doing up to now, is whenever I've found a need for a public variable, I initialise all of them in the same place - a "re_init" prg which establishes all the variables at the beginning of the app loop.
>
>I would just move it to a place in teh startup.prg
I can see the sense of that...
>
>>but when you do need them, how do you get around the inability to use the syntax " &thisform.property" ?
>
>
>lcMacro = Thisform.Property
>&lcMacro
thats what I was afraid you'd say!
ach well, lets get hacking...
Thanks Jim
Harry
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement