• 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: NSPopUpButton again
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton again


  • Subject: Re: NSPopUpButton again
  • From: Johnny Lundy <email@hidden>
  • Date: Fri, 9 May 2008 09:17:32 -0400

Thanks Ken.

That worked. I thought I had to bind everything through the Controller. It seemed to me that I wasn't allowed to bind a View item's (the NSPopUpButton) property directly to a model object's (popup.selectedGame) property. But I do not see any way to use the controller here to communicate with a property in the Model, except to get its Content from the Model, which works fine.

The Controller actually doesn't even have any "selection" binding except "Selection Indexes". Very different from when I bind a TableView to an array controller...

My popup button now sets the model object string value.

If you have any more tips I would love to hear them. I have literally read every word I can find about this class and still could not make it work.

Thanks again

Johnny
On May 8, 2008, at 10:05 PM, Ken Thomases wrote:

On May 8, 2008, at 8:56 PM, Johnny Lundy wrote:
Bindings:
1. My NSPopUpButton is bound with its Content, Content Objects, and Content Values to the NSArrayController's arrangedObjects.self.


2. The NSArrayController's Content is bound to Popup.popupArray through an instance of the class Popup in IB (see #3).

3. An NSObject "popup", instantiated from within IB, has its Class set to "Popup." Binding to that to get the array content works fine (popup.popupArray).

I can't figure out what to bind the NSPopUpButton's "selection" bindings to, to get the instance variable "selectedGame" to be set to whichever of the two items in the popup is selected by the user.

I haven't tested, but my understanding is that you bind the NSPopUpButton's selectedObject to popup.selectedGame. Since the Content Objects and Content Values are both bound to the same thing, you could bind selectedValue to popup.selectedGame, too.


Cheers,
Ken


_______________________________________________

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


References: 
 >NSPopUpButton again (From: Johnny Lundy <email@hidden>)
 >Re: NSPopUpButton again (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Crashes with NSOpenPanel and garbage collection
  • Next by Date: Re: NSApplicationMain & Main NIB File
  • Previous by thread: Re: NSPopUpButton again
  • Next by thread: Re: NSPopUpButton again
  • Index(es):
    • Date
    • Thread