Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controlling order of instantiation
Message
From
30/07/1997 08:57:09
 
 
To
30/07/1997 08:41:35
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00042294
Message ID:
00042303
Views:
33
>>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
>
>Objects are instantiated in the order that they are placed in a container/form. I'm pretty sure the only way to control it is to remove them and put them back in the order you want. You could cut and paste to another dummy form...
>
>But I like this way better....in the init events for the objects requiring control, use something like...
>
>PARAMETERS lCalledByForm
>
>IF lCalledByForm
>. {place init Code here}
>ENDIF
>
>RETURN lCalledByForm
>
>In the Form.Init use something like
>
>THISFORM.Object1.Init(.T.)
>THISFORM.Object2.Init(.T.)
>THISFORM.Object3.Init(.T.)
>
>That way you control the initialization of each object from the init of the form
>
>HTH
>
>Matt

Thanks Matt. This is great. I was afraid to put calls to init in an init, but I hadn't thought of the step of adding the parameter to the object's init -- that would stop the recursion I feared.

Thanks again.
Valerie
Previous
Reply
Map
View

Click here to load this message in the networking platform