Re: Binding NSArrayController to model array without NSTableView: Master-Detail interface
Re: Binding NSArrayController to model array without NSTableView: Master-Detail interface
- Subject: Re: Binding NSArrayController to model array without NSTableView: Master-Detail interface
- From: Fred Glover <email@hidden>
- Date: Thu, 10 Feb 2005 09:04:16 -0800
On Feb 9 mmalc wrote:
On Feb 9, 2005, at 7:24 PM, Fred Glover wrote:
Its selectedObject is bound to ModelController: selection
That's the problem.
You should have something like:
@interface MyDocument : NSDocument
{
NSMutableArray *modelArray;
Model *selectedModel;
}
- (NSMutableArray *)modelArray;
- (void)setModelArray:(NSMutableArray *)aModelArray;
- (Model *)selectedModel;
- (void)setSelectedModel:(Model *)selectedModel;
@end
Then bind 'selectedObject' to [MyDocument].selectedModel
To represent the selection, add an NSObjectController, with 'content'
also bound to [MyDocument].selectedModel
mmalc
BINGO!
and I don't need the "indexed accessors" in MyDocument
there's one small additional detail that only took me one run to find:
The two NSTextViews in the detail interface are now bound to the
NSObjectController:selection.name and selection.index (instead of the
NSArrayController).
Thanks so very much. I'm not sure I'd ever have figured that out from
the documentation and examples. Now I can proceed with the "real work"
Fred
Fred Glover
Machine Vision and Image Processing Engineering
Visicon Inc
www.visiconeng.com
Los Gatos, CA
408 354-0095
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden