Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tip of the Day
Message
De
19/10/1999 15:10:18
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00278095
Message ID:
00278415
Vues:
13
>When you run one form from another, in Init() of child form you may access the properties and methods of the parent form directly without passing the parameters - i.e
>
>thisform.someProperty =_screen.activeform.myProperty
>or
>thisform.someControl.Value =_screen.activeform.someControl.Value
>
>This is based on the fact that when the child form is in its .Init() it is not an activeform yet, because its .Activate() didn't fire so far, so the calling form still stays active at this time.
>
>Nick

I agree with John, a nice tip. However, I have some concerns:

- It's a potential trap for anyone maintaining this code, who doesn't know this tip. OTOH, it explains why you don't get the results you might superficially expect when trying this code in the child .Init().

- It doesn't respect object encapsulation the way that explicitly passing parameters (or a parameter object) does

- MS, in its infinite wisdom, could "silently" cause this behaviour to break - or move it to another event/method - in a new release of VFP.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform