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:
00688802
Vues:
12
Armin --

If you have all of the component parts of the container class, you could create your own container class in a differently named classlib, using the appropriate combination of framework classes and your own classes -- appropriately named.

This would work if the object is instantiated under your control. If the class is instantiated by the framework, then do you have control through a property, or other mechanism, to ensure your class is used?

Jay



>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform