Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reference to parent object.
Message
De
07/12/2004 13:57:19
 
 
À
07/12/2004 09:00:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP3
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00967446
Message ID:
00967552
Vues:
7
Hi Sylvain,

I was trying to avoid as many references as possible. David's suggestion to use AddObject will do the trick nicely.

Thanks for your examples - they are much appreciated.

Best

>You can add a property that hold a pointer to the parent:
Thisform.AddProperty ('oMyClass', CreateObject ('MyClassName'))
>Thisform.oMyClass.AddProperty ('oMyParent', THISFORM)
>...
>*-- In a MyClassName method
>THIS.oMyParent.Caption = "Test"
Be very careful of releasing the pointer (MyClassName.oMyParent) before releasing the parent form. You can use this code in the Destroy event of the form to assure this:
THIS.oMyClass.oMyParent = NULL
HTH
>
>>I have a class that is added to a form property using :-
>>
>>
>>Thisform.AddProperty('oMyClass', CreateObject('MyClassName')
>>
>>
>>Without passing a reference to the class of Thisform, is there anyway in the class to access ThisForm ? If in the object, I refer to THIS.PARENT, it does not get me a reference to the containing form.
-=Gary
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform