multiple targets/selectors
multiple targets/selectors
- Subject: multiple targets/selectors
- From: "Sven A. Schmidt" <email@hidden>
- Date: Wed, 26 Dec 2001 13:35:55 +0100
In the little app that I'm working on I've encountered the following
problem:
I've got a menu from which I'd like to trigger messages in more than one
object. From what I gather, I can set one target and one action, and I
could surely work around this problem but it would be a lot more elegant
to trigger two different targets/actions directly.
To be a bit more specific:
I have a server object that controls a global menu. The items in that
menu are connected to the clients (to their "quit" action). Now, I'd
like the server to know when the clients are getting the quit message.
Like I said, it's easy to think of work-arounds:
a) send a message from the client that it's quitting
b) connect the items to the server and have it pass on the message to
the clients
I don't like (b) that much (for a lot of reasons that all boil down to
being lazy). (a) is easy to do, but I've got the connection right there
and it seems like taking an extra corner from the menu to the client to
the server when I'm almost there already. Plus, there might be occasions
when it's not that easy.
So, is there some message cascading available in obj-c that I'm not
aware of or is it just considered bad design to distribute messages
without a proper control object?
Sven