Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about assign methods
Message
 
À
15/06/2004 22:56:52
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:
00914242
Vues:
7
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


>Does the following make sense?
>
>I want to set key properties of a container at the container-level. The properties are really relevant for the contained objects, but I want to have key definitions in one central location.
>
>Assign-methods will copy the properties to the corresponding properties of the contained objects. In some cases, they will be copied as-is, in others, additional manipulation is required.
>
>Since I can give the properties at the container-level values in the property sheet, I force the assign methods to be executed, by assignments such as:
>
>
>This.Property1 = This.Property1
>
>
>Does this work, does it make sense, or is there perhaps a better way?
Low-carb diet not working? Try the Low-food diet instead!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform