NSPopUpButtonCell bindings help
NSPopUpButtonCell bindings help
- Subject: NSPopUpButtonCell bindings help
- From: "Jim Thomason" <email@hidden>
- Date: Mon, 23 Apr 2007 21:13:58 -0500
I'm having trouble with bindings on an NSPopUpButtonCell. I could find
a few references to the same problem that other people have had in the
past, but alas, had no luck with solutions.
Here's the deal - I have an NSPopUpButtonCell whose content is
populated based off of another field. So the "nextDate" attribute
changes, and that rebuilds my NSPopUpButtonCell data. This means that
each popupbutton cell has its own choices. But, as I do it, I need to
change the data around into user presentable values, not just numeric
constants. It's stored internally in the "repeats" attribute.
So I run the date through a transformer to get a dictionary with two
keys - val (the numeric constant I want) and display (the value I'll
present to the user)
The bindings on the column are as follows:
content - arrangedObjects.nextDate (running through a transformer to
get an array of dictionaries with two keys - val and display)
contentObjects - arrangedObjects.nextDate.val
contentValues - arrangedObjects.nextDate.display
selectedObject - arrangedObjects.repeats
The problem is with the selectedObject. If I remove that binding, the
list properly populates (though I can no longer save selections). When
selectedObject is bound, I always get this error:
2007-04-23 20:30:44.078 Debtinator[14043] [<NSCFNumber 0x308520>
valueForUndefinedKey:]: this class is not key value coding-compliant
for the key display.
My guess is that it is internally looking at the numeric constant (the
NSNumber that the "repeats" attribute has), as opposed to looking at
the dictionary sent through my transformer.
This is all quite odd to me, since in a few other places, I have an
identical setup, except that it's an NSPopUpButton (not a cell), and
it's bound to selection (not arrangedObjects), and it works just fine.
So something about moving to either the cell or to arrangedObjects
causes it to fail.
And I'm stumped. Any suggestions?
-Jim.....
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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