Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Mediator Class
Message
De
07/06/1998 08:43:03
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
A Mediator Class
Divers
Thread ID:
00105603
Message ID:
00105603
Vues:
76
Heya All,

I had posted this on compuserve, but I figured it was time I started bothering people up here with my babbling :-) So...

When I've had 2+ objects that rely on each other for information I've always used a form or container class of some sort to do the inter-object communicating. IOW, the objects don't know about each other just their "parent".

I'm assuming this type of setup is a Mediator pattern, sort of...yes?

Okay I now need a Mediator class that isn't a container or the "parent" of the objects. IOW, the objects (4) will be on different pages, possibley different forms. So I thought I would create a class that would be able to receive messages from the object when one of them has change and would them tell the others that they need to update themselves.

What I figured I need is:

Each object would have a reference to mediator, and the mediator woudl in turn have a reference to each object. Which seems easy enough if I have each object "register" itself with the mediator class passing THIS as a parm.

What I'm missing is ...how would each object know how to send that first message to the mediator. For instance, the register method would look something like.

mediator.RegisterMe(THIS.Class, THIS)

...the problem is getting that pointer to . I would love something that I could store in a property so it's easily edited...something like... .

.mcMediatorRef = "thisform.oMediator"

and then something like..

loMediator = (.mcMediatorRef ) && or maybe EVAL()
loMediator.RegisterMe(THIS.Class, THIS)

But I wan't sure if this was the "proper" way

Thanks,
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform