Re: NSPopUpButton binding
Re: NSPopUpButton binding
- Subject: Re: NSPopUpButton binding
- From: "Marcus S. Zarra" <email@hidden>
- Date: Thu, 1 Dec 2005 17:52:03 -0700
Thanks for the reply, what I have done in the interim is set myself
up with a getter/setter for the string in a subclass of
NSManagedObject. I have also set up a method that returns an array
of the options for the drop down. With this the GUI has the
contentValues binding set to the NSArray and when the user selects an
item from the NSPopUp the setter is called with the string. That
setter then does a string compare and sets the appropriate integer
back into the NSManagedObject.
It is a bit messy but works. I was hoping for a cleaner way to solve
this issue without having to create the code behind it.
Glad you enjoyed the article. The more I learn about this wonderful
language/development platform the more I want to write about it and
share the experience. Sure makes working with Java more and more
difficult :) Especially doing any kind of GUI development.
On Dec 1, 2005, at 11:14 AM, John Pannell wrote:
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
_______________________________________________
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