Re: NSTableView confusion
Re: NSTableView confusion
- Subject: Re: NSTableView confusion
- From: James Maxwell <email@hidden>
- Date: Sat, 4 Oct 2008 12:32:51 -0700
Thanks, Keary.
I eventually found the article you linked me to and worked it out. I
think I've done everything correctly, in that I am pointing the
"choices" to an array of objects, and using the "name" property to
display in the popup... It seems to be okay, but I won't really know
until I get it properly connected to a testable build (it works
graphically, but I can't be certain it's actually selecting the right
thing). Thanks for the tip, though!
But I've got an even more mysterious problem now... My preferences
window (the window I was working on) will only open once!... I'm
totally baffled. I can open it once per run of the app, but if I close
it, then it's gone for good. Totally frustrating...
I have to admit that I kind of dread opening Interface Builder. I
enjoy graphically creating interfaces with it, but I find the
"connections" to my code totally confusing. If you have any ideas (or
if anyone else has) as to why my preferences window appears only once
please give me a heads-up. I'm in absolute disbelief! :-|
cheers,
J.
On 4-Oct-08, at 11:03 AM, Keary Suska wrote:
On Oct 3, 2008, at 2:17 PM, James Maxwell wrote:
This doesn't seem like a big deal, but I'm pretty confused. I want
to set this up using bindings, but I'm note sure how I populate the
popup in column 2, and I'm also unclear on who manages storing the
index of the popup selection? Do I need to have a method to handle
this in my XObject class, or is this something NSArrayController
does?
A popup in a table cell is handled much the same as a standard
NSPopupButton. Although I hope you have already read "Cocoa Bindings
Programming Topics" completely, here is a link to the specific
section that addresses your need: <http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Tasks/onerelation.html#//apple_ref/doc/uid/20002301
>
What you need to determine up front is what value or object
represents the "key" to the relationship between the column 2 value
and the "choices". I do not recommend using anything based on the
arrangement of items, such as selection index, as the approach isn't
extensible. Remember that this key must be a unique object, and that
every data row must use the same object for its equivalent value.
This is really important, and is an issue not easily gleaned from
the documentation: the object used in your data row as the value
must be the exact same object as is found in the "choices" array.
Being equal is not sufficient.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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