Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controlling order of instantiation
Message
 
À
30/07/1997 08:32:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00042294
Message ID:
00042442
Vues:
30
>Hi all,
>
>Is there any way to control the order in which objects are instantiated in a class (in the class designer)? I want to place some code in the init event of an object of a custom class which must run before the init event of another object of the same class. Is there any way to do this?
>
>Thanks,
>Valerie
Valerie,

Depending on instantiation order is a desing flaw. The best way to handle you requirement is to let the Custom class act as a mediator for those objects and put the code in the Init of the Custom class to intervene between the other two classes. IOW, if I have two textboxes Text1 and Text2 in a Custom class I woudl write code like this in teh Custom class Init;

THIS.Text2.ControlSource = IIF(THIS.Text1.ControlSource="FName", "LName","FName")

This way this code is not in the init of Text2 where it would required that text1 was instanitated first, instead it is in the INit of the Contianre where we know all contained controls have been created.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform