First responder design question. Are controllers in the chain?
First responder design question. Are controllers in the chain?
- Subject: First responder design question. Are controllers in the chain?
- From: David <email@hidden>
- Date: Thu, 11 Sep 2008 10:59:46 -0400
I'm just starting to delve into the first responder chain to handle
menu actions.
My conceptual understanding of MVC is that the controller is the one
who determines what to do with actions. When someone wants to do
something the controller is told by a control in the view, it updates
the model and in turn updates the display.
I've been conceptually thinking of the document as part of the model.
The first responder chain in the document architecture goes through
the view hierarchy and checks the document. It doesn't go through the
controllers. I'm not sure how it would even know about them.
But in any case, the actions that I want the menu to invoke are on my
controllers. I want them invoked in the same way that I have buttons
in the UI which send actions to the controller.
Given that the default first responder chain does NOT include
controllers... architecturally, what is the best approach to get the
actions invoked?
Options include:
1. I can add methods to my Document to forward the messages to the
controller. But this seems to confuse the model and controller. Now
I'd have the model receiving the action, sending it to the controller
which may in turn send it back to the model.
2. Subclass something in the view so that it forwards the message to
the controller. Maybe an NSWindow delegate? I've been trying to avoid
subclassing view classes if I don't need to. So far I haven't had to
subclass any of them.
3. Modify the first responder chain and specifically add one or more
controllers to the chain. Where would be the appropriate place to
modify the first responder chain?
Thanks
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden