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

Re: NSPopUpButton binding


  • Subject: Re: NSPopUpButton binding
  • From: John Pannell <email@hidden>
  • Date: Thu, 1 Dec 2005 11:14:57 -0700

Hi Marcus-

You don't mention *which* integers you are interested in, so this might not help. If you are interested in the index of the selected object from your source array, it will.

You can bind the content and/or contentValues of the pop-up button to an array controller containing your list of options. You can then bind the selectedIndex of the pop-up to another controller, and it will keep the index of the object chosen as an integer. I tried this with a pop-up in one of my apps, and bound the selectedIndex to my Shared User Defaults, and verified that the index of the selected item was stored as an integer.

If the index is not what you are looking for in an integer, you might be able to do something between binding the content, contentObjects, and contentValues, to squirrel away the string you want displayed in one of them, and the associated integer in another, and then bind the selected(Index/Object/Value) to get the desired integer in your other controller.

HTH!

John

PS. Enjoyed your Core Data article... http://www.informit.com/ articles/article.asp?p=428070&rl=1


On Dec 1, 2005, at 9:18 AM, Marcus S. Zarra wrote:

Hopefully this is a simple question for the group.

Is there a way to bind an NSPopUpButton so that it displays a list of strings but sets integers to a bound value? In addition is there a way to do this in IB directly without having to write code for it?

Any suggestions would be greatly appreciated. I know how to do this programmatically but would really like to be able to do it all with bindings.

Thanks,

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

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
  • Follow-Ups:
    • Re: NSPopUpButton binding
      • From: "Marcus S. Zarra" <email@hidden>
References: 
 >NSPopUpButton binding (From: "Marcus S. Zarra" <email@hidden>)

  • Prev by Date: Re: Problem with setNeedsDisplay: in derived NSOpenGLView
  • Next by Date: Re: CoreData, TextView and Bindings
  • Previous by thread: NSPopUpButton binding
  • Next by thread: Re: NSPopUpButton binding
  • Index(es):
    • Date
    • Thread