Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Control init fail, class init fail
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00428995
Message ID:
00429437
Vues:
22
Michelle,

Conditional instantiation is nasty anyway you look at it. And it appears the VFP has recently changed behavior. It used to bubble up these contained object instantiation failures and not instaniate the outermost object. But VFP6SP4 is not behaving that way now from a test I just ran.

The suggestion of using a public is bad because public variables are bad.

The suggestion of using .parent property are bad because they require that the objects can only be put into a container that supports the "conditional instantiation" property.

If your container did a test of it's ControlCount to see if everything inside it instantiated is bad because you have to maintain the nHowManyChildObjectsShouldIHave property at the right value which is a PITA as you are adding/removing things.

Seeing your reply to Bret, why not make your objects a little smarter in the first place to obviate the need of failing to instantiate? If the parent object isn't big enough the contained objects can make it bigger: this.parent.Resize() which could run a calculation to find the max X-Y coordinates used by all it's contained objects.

>I have a custom class based on a container. If one of the controls inside fails to init, I want the whole container not to init. Or maybe do some other action at the container init level. Since the container inits last, is there some way to pass its init event a message that one of its objects failed?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform