On Sun, 13 Jul 2008 16:48:45 +0100, Keith Duncan <[EMAIL PROTECTED]> said: >I'm working with NSViewController to create a workflow of controllers. >I'm trying to patch the controller into the responder chain so that I >can implement action methods in the specific controllers and in the >window controller. > >I'm using the following code in an attempt to create a responder chain >like this: > >ButtonView -> ContainerView -> MyViewController -> WindowContentView - > > Window -> WindowController -> etc... > >- (void)setViewController:(TLViewController *)controller { > if (_viewController != controller) { > [_viewController release]; > _viewController = [controller retain]; > _viewController.controller = self; > > [self setActiveContentView:[_viewController view]]; > > // Patch into the responder chain > // This must be done after the view has a superview > [_viewController setNextResponder:[[_viewController view] >nextResponder]]; > [[_viewController view] setNextResponder:_viewController]; > } >} > >However, it isn't working. The view controller doesn't receive any >messages
This might not be of any help, because I know nothing whatever about NSViewController or why you'd want to insert one into the responder chain (and whether that's okay or necessary to do). But I *am* a *huge* fan of inserting stuff into the responder chain - it's something I do all the time. And when I do it, I patch the chain in opposite order. For example, in several of my apps I inject an NSResponder subclass instance after an NSTableView (so, between the table view and the window - actually, it's between the table view's containing scrollview and the window). And here's how the code goes (I use awakeFromNib and keep an instance of my NSResponder subclass in the nib, so that I am guaranteed of having just one and of having everything hook up at the appropriate moment): - (void) awakeFromNib { NSResponder* r = [[myTableView enclosingScrollView] nextResponder]; [[myTableView enclosingScrollView] setNextResponder: self]; [self setNextResponder: r]; } It might help or it might make no difference at all, but that's the kind of thing that works for me... m. -- matt neuburg, phd = [EMAIL PROTECTED], <http://www.tidbits.com/matt/> A fool + a tool + an autorelease pool = cool! One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf> AppleScript: the Definitive Guide - Second Edition! <http://www.amazon.com/gp/product/0596102119> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]