Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get rid of a child object in a class at runtime
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00688718
Message ID:
00688760
Vues:
12
This message has been marked as a message which has helped to the initial question of the thread.
I almost sure that you cant remove an object from a container in this case.

Depending on the type of object and the nature of the code you put in it,
you can hide the original object but use it as a proxy to the one you want to add.

You just have to call your new object methods in the same original object methods...

HTH

>Hi,
>
>I have a framework container class which hosts another object as a child. I would like to replace the child object with my own. The problem is, my object should have the same name as the original object, so the code in the container class that references the child object is not broken.
>
>I know that I can't remove or rename the child object in design mode, so I wanted to do that at runtime. Does anyone see a chance to get rid or to rename the original object at runtime?
>
>What I've tried:
>
>1) Putting RETURN .F. in the Init of the child. When adding my own class with the same name I get an error saying that the name of the new object is invalid.
>
>2) THIS.oObject.Name = "Banana" - results in "property is ReadOnly".
>
>3) THIS.RemoveObject("oObject")
>THIS.AddObject("oObject", "myclass")
>
>gives same error as 1).
>
>TIA,
>Armin
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform