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

Re: bindings, coredata, NSPopUpButton


  • Subject: Re: bindings, coredata, NSPopUpButton
  • From: email@hidden
  • Date: Fri, 9 Sep 2005 11:54:58 -0500

I've just recently had to deal with this: use an NSObjectController to manage a set of radio buttons and enable various text fields associated with each, and to handle some popup menus. The popup menus are directly bound to attributes using the tag value binding, as you've surmised, using the controller and its selection and the attribute name as key. Just make sure in IB that you set the menu items to have the tag values to match the values you want set in your attributes.

Matt Holiday   --    http://homepage.mac.com/matthol2/cocoa/

On Sep 8, 2005, Eric Friedman wrote:

Message: 12
Date: Thu, 8 Sep 2005 16:16:51 -0700
From: Eric Friedman <email@hidden>
Subject: bindings, coredata, NSPopUpButton

I have an entity with an attribute that I wish to store as an integer value in a bounded range. In the UI, this attribute is editable with a popup button that can contain descriptive text labels for each of the possible integral values. So, 1 = Red, 2 = Blue, 3 = Green.

Is there a way to use bindings so that the tag of the NSMenuItem selected in the popup gets read/written in this attribute?

I realize that I can create another entity with my titles (Red, Blue, Green) and then change the attribute into a relation to that entity, but that's not going to work out very well when it comes to internationalization. Also, I imagine that adding these additional tables is not going to be beneficial w.r.t. performance (since I'd end up with a join for each relation). Finally, I suspect that doing it this way would mean I'd have to write code to sort the titles for the menuitems, since those would come back in an unordered set. Binding NSMenuItem's tag to the attribute would allow the localizable nib file to carry the titles in the correct sorted order.

What's the conventional wisdom for approaching this problem?
_______________________________________________
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: Newbie Q - Variables not being retained in class
  • Next by Date: Re: iTunes playlist icons
  • Previous by thread: Re: bindings, coredata, NSPopUpButton
  • Next by thread: draw selected NSSegmentedControl image?
  • Index(es):
    • Date
    • Thread