• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binding NSArrayController to model array without NSTableView: Master-Detail interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Export data to excel
  • Next by Date: Re: Sample code won't link now that I have updated to panther
  • Previous by thread: Re: Binding NSArrayController to model array without NSTableView: Master-Detail interface
  • Next by thread: NSTableView can't delete last column?
  • Index(es):
    • Date
    • Thread