• 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: [Newbie]:Bindings and pulldown menus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Newbie]:Bindings and pulldown menus


  • Subject: Re: [Newbie]:Bindings and pulldown menus
  • From: J Tichenor <email@hidden>
  • Date: Tue, 14 Sep 2004 21:28:59 -0700


You've gotten things a little wrong. You need to bind the contentArray of the NSArrayController to your main data controller, with the model key path projectTitles, no controller key (assuming that this main data controller is the file's owner). You set the Object Class Name to the class of the elements of the NSArray, so if you have an array of instances of Foo, you would set it to foo.


That all makes sense. I am in the right ballpark, just all mixed up. cool. Thanks for the clarifications.


You then bind the content values to the nsarraycontroller. The model key path depends on what you want the popup to display. If your array objects have some KVC compliant variable blah that you wanted the popup to show, you'd set the model key path to blah.


This is the only part I don't understand. If I have an array full of titles, which are NSStrings, how would I write a method that would return a since title, without some other information as to it's index in the array, etc? I've been binding to the array itself, as opposed to a since object in the array, assuming that the menu would cycle through the array and -addItemWithTitles on it's own.


I keep thinking I should just subclass the popUpMenu and do all this programatically, at least so I know how to do this. I always seem to get lost in the bindings, even though I do know I need to know it, if that makes sense...

Thanks and I'll look at the ToDos example again,

J


This is easier to work out if you have a working example you can fiddle with, IIRC the Todos example on mmalc's page demonstrates this.

Fred

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ 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
References: 
 >Re: [Newbie]:Bindings and pulldown menus (From: Frederick Cheung <email@hidden>)

  • Prev by Date: query: setNeedsDisplay
  • Next by Date: Re: Debugging System Prefpane
  • Previous by thread: Re: [Newbie]:Bindings and pulldown menus
  • Next by thread: Breaking source file into multiple files?
  • Index(es):
    • Date
    • Thread