Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about assign methods
Message
De
16/06/2004 11:04:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00914118
Message ID:
00914270
Vues:
8
Thanks. Well, while this is an interesting pattern, I think it applies only loosely to my particular needs in this case. The dependency is not 1-to-many, but 1-to-1, and I don't mind if the Container needs to know exactly which contained objects need to change.

In what version was "BindEvents" introduced? My client - for this particular project - wants to continue with VFP6 (note: he does a lot of the programming; I help out). Therefore, I think that isn't an option right now.

>Hola Hilmar,
>
>You might want to look a bit at design patterns; specifically the observer pattern (http://fox.wikis.com/wc.dll?Wiki~ObserverPattern~SoftwareEng).
>
>The assign method seems to be a good place to start as it's very similar to an event.
>
>What I would do is create a mechanism with which the contained objects "register" themselves with the container (maybe have their init events tell the parent about their presence - this.parent.RegisterContainedObject(this)).
>
>Then in the assign method of the properties in the parent, a loop to go through all the registered contained objects and call them Hey_YourParentHasChanged() method, which will have them look at key properties in the parent object.
>
>Another approach you might want to explore is to do this somehow through bindevents() because, what you're really doing here is raising an event and having all or some of the contained objects respond to it.
>
>have fun!
>
>Alex
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform