Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Uncontained Class
Message
From
29/03/1999 13:16:35
 
 
To
29/03/1999 10:44:28
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00202995
Message ID:
00203072
Views:
16
>I have created a class that I instantiate as follows:
>
>THISFORM.oClass = CREATEOBJECT("ClassName", Param1, Param2)
>
>Everything works fine--all methods and properties are available as expected, i.e., THISFORM.oClass.CheckForConflicts() works fine. However, whenever I try to refer back to THISFORM from within a class method, I get an error. If I, for example, attempt the following from within THISFORM.oClass.CheckForConflicts(), it bombs:
>
>THISFORM.oDataManager.Replace([Parameter list])
>
>The error states that object is not contained in a form (error #1938). I work around the problem by passing THISFORM as a pointer and storing it as a property in the Init method of the class. But I don't get it: If THISFORM.oClass.[WHATEVER] works, how can oClass not be contained in a form??
>
>Thanks, out there, y'all, for any light you can shed.
>John

John, you are getting confused between a property that refers to an object, and a contained object.

If you created a form property called oClass and then made it a reference to an object using, CREATEOBJECT, you have not added a member to the form, you have created an object and set the form's property as a reference to it. If you want the object to actually be a member of the form, you should use

THISFORM.Addobject('oClass', 'ClassName')
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform