Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create member in code before other members instantiate
Message
 
To
31/08/2009 14:36:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01421954
Message ID:
01422112
Views:
95
Hi Dragan

I am not sure why the technique you describe does not work since I use it all the time in my framework. What I do is build all my GUIs in a containers which are then added to a form (with private data sessions) at runtime. The first element in the container is bizObj loader. Its init fires before anything else in the container creating the bizObj and adding it to the container. Since the bizObj loader's init returns false it is never created leaving just the bizObj in the container. The bizObj opens all the tables and then the rest of the controls are created. So I am wondering why this does not work for you. I have been using this technique for a number of years and still do it this way in VFP9.

Simon

>Just the trouble of making a proper title for this suffices to show what sort of balancing act I am trying to pull.
>
>I'm trying to create a bizobject as a property (or member, if possible) of a container, such that it would exist before the controls on the container are instantiated. This bizobj would open the tables for the controls, so it's necessary that it is created before everything else.
>
>In earlier incarnations of VFP it was simple - in the base container class you have a dummy object, a loader (in VFE it was the DeLoader, a simple label) which would do something like
>
>this.parent.addobject("oBiz", this.cBizClass)
>
>and that would do it. The label would return .f. from its init, as it wasn't needed later. Any objects added to the descendants of such a container (or form or whichever composite object) would be instantiated after this. However, this doesn't work anymore, if you have a member which is a composite object with memberclass, like a pageframe or a grid. That object gets instantiated before anything else, and even its objects' .init()s run before the objects defined in the parent class are instantiated.
>
>The only workaround against this, that I was able to cook up, was to instantiate the bizobject via a function in the expression for its property. Either of these works as the property value for the oBiz:
>
>=newobject("mybiz", "mybiz.vcx")
>
>=oFactory.Create("mybiz")
>
>The trouble is that this attempts to create the damn bizobject at design time too. As the bizobject's instantiation may rely on pieces of the framework which aren't there at design time, I only need a way to prevent this. So, my question is what is the trick to have an expression in the property which will return an object at runtime, and yet do nothing when I Modify Class mycontainer?
Simon White
dCipher Computing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform