Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memory variable
Message
 
À
04/10/1998 22:16:06
Anthony Thomas
Attn Plus Private Nursing, Programmer
Honolulu, Hawaii, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00143748
Message ID:
00143770
Vues:
21
>If it's on the same form, then you can reference it as thisform.object.property
>
>or
>
>you might need this.parent.object.property
>
>in either case the variable you are refering to has to be in the same form.
>
>the easy fix is to use the old methods. Declare the variable public, use it and release it.

Declaring any variable public is taking the lazy way out of the problem. There is no restriction as to from where you can refer to an object's property. You just need to know the object's name or have a reference to it.

There is only one reason to make a variable public, that is that it needs to referred to at a higher level in the calling stack. If a higher routine is referring to the variable and it does not create the variable then there is a tight external coupling problem with the code. Tight external coupling won't get you right away, but 3 - 6 months down the road when you modify the program you will spend alot of time scatching your head trying to figure out where that variable gets is value.

It is acceptable for a container to know about its contents and for an object to know about its parent. Using a property of the form is the right way to solve the problem in this thread.

If you haven't figured it out yet, I am of the belief that the 11th commandment (on the back of the stone tablets) was Thou Shalt Not Use Public Variables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform