Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom.dataenvironment.crash
Message
From
17/06/1999 18:39:19
 
 
To
17/06/1999 16:32:58
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00230749
Message ID:
00231141
Views:
17
Your example was not an example of containership. Just because your Custom class holds a reference to a session object and that session object holds a reference to a dataenvironment object, doesn't make the session a member of the custom and the DE a member of the session. Yes, a dataenvironment object can exist independently, but if you want to contain it, you have to contain it in a form.

What's more giving a custom object a reference to a session object, does not automatically give that custom object a private datasession. (BTW, a base class session object gets you nowhere toward a private datasession anyway: the datasession propetry is read-only at run time; you have to subclass it to change the datasession property to 2- private). Yes, you can add a reference to the object, check it's datasession property and SET DATASESSION to that value. That will work.

From a strategy point of view however, why use DE objects and custom objects at all? Why not just base you business classes on the session class and be done with it?




>Terry,
>
>It's not a form container.
>
>Try something this with the custom class Init:
>
>WITH This
>
> .AddPropery([oSession], .NULL.)
> .oSession = CREATEOBJECT([Session])
> .oSession.AddProperty([oDataEnvironment], .NULL.)
> .oSession.oDataEnvironment = CREATEOBJECT([DataEnvironment])
>
> *!* Now you can add your cursors
>
> WITH .oSession.oDataEnvironment
>
> .AddObject([Cursor1], [Cursor])
> *!* blah, blah, blah
>
> ENDWITH
>
>ENDWITH
>
>
>>In the init event of a subclass of the custom object from _base.vcx, I have the following code:
>>
>>this.addobject("de","dataenvironment")
>>this.de.addobject("cursor1","cursor")
>>this.de.cursor1.alias="custs"
>>this.de.cursor1.cursorsource="customers"
>>this.de.cursor1.database="cc"
>>this.de.cursor1.nodataonload=.f.
>>
>>I get the error:
>>"Object class is invalid for this container" upon attempting to instantiate the dataenvironment object.
>>
>>I have tried using the container class instead of the custom class with the same results.
>>
>>I heard this can be done. Does anyone know what I am doing wrong here?
>>TIA
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform