Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who's in control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Who's in control
Divers
Thread ID:
00257679
Message ID:
00257679
Vues:
56
I just started learning VFP about 2 months ago, as well as working in an OOP environment so I am a little unclear on how to notify objects in a series of containers about an event.

I pretty much understand the concept of an object is in control of it's own environment and nobody should play with it's stuff. I think Dragan said it best in another post today 'Your controls should be grown up independent controls, capable of taking care of themselves.'

Today I was working on some methods to resize controls when the form is resized. So I built an array of the forms controls that could be resized in the forms init. Thinking that I would also do something similar for each container that might happen to be on a form. At init every object builds its own array of it's child objects. Then just add a DoResize method to everything and let each object take care of itself.

I of course realized that didn't work when I hit the pageframe. It's children are containers that can't be subclassed. Bummer. And I feel that is probably not the best OO way to do it.

So I started to think about taking a bottom up approach. Have each child tell the parent it exists, if the parent can't deal with it just go to the next parent up the line. Problem is, at init, the parent doesn't exist yet.

So it seems if you want the most top-level parent to inform all of it's contained objects that something happened, that parent is going to have look for all children.

So is drilling down the way to do it, or is there another way?
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform