Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scope of a form's Property Value
Message
 
À
24/08/2002 21:58:15
Carmen Gassi
Perseus Software Systems
Oakville, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00693357
Message ID:
00693388
Vues:
18
Carmen,

Be careful when using the form object's name like that. You have no guarantee that the form's name will be what you think it is.

If a child form needs to deal with a parent form's properties then that child form should be created from code within the parent form. This is just good programming to keep the dependant form under the complete control of the "owner" form. Once you do this it is easy to send the object reference when the child form is run. In the parent form's code that runs the child do this;
* Some code somehwere inside of the parent form
DO FORM ChildForm WITH Thisform && this sends the Thisform reference to the child as an argument
Now in your child form add a property named oParentForm using the Form menu in the form designer. Also add this code to the child form's Init method;
* Child form's Init
LPARAMETERS poParentForm
Thisform.oParentForm = poParentForm
Now whenever, in the child form, you want to access a property of the parent form you can ...
Thisform.oParentform.SomePropertyName
And there is no dependance on any form object names, the code is generic. This means that your child form could be called by a number of different parent forms and it will always address the form that called it.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform