Cocoa Custom NSCell Binding Issue
Cocoa Custom NSCell Binding Issue
- Subject: Cocoa Custom NSCell Binding Issue
- From: Sean Willson <email@hidden>
- Date: Wed, 11 Jan 2006 20:09:37 -0600
I'm having trouble coding a custom NSCell class for use in an NSTableView
while using Cocoa Bindings to bind it to a custom class. My test cases of
the componant in it's own NSTableView work great when I don't do bindings
but instead set a action to call a method on the delegate of the table for
example. So here is my binding structure that is failing
Object A
- Implemented getter and setter methods conforming to the set<Key> and
<key> naming conventions.
- They key in question I am using is "rating"
- Return type I've tried is NSNumber as well as double primative
NSArrayController
- Has an array of Object A's within it.
Custom Rating NSCell
- Binding set to the NSArrayControllers "arrangedObjects" controller key
with the "rating" Model Key Path
NSCell Custom Class
- Implemented the setObjectValue and it can accept NSString and NSNumber
objects. When it was a primative I wasn't sure how to get the value but
that's another story.
- Implemented the objectValue method to return the current objectValue as
an NSNumber which is the current "rating" value of the cell.
- All methods are KV compliant for notification of change. I have methods
simular to the NSLevelIndicator for setMinValue, setMaxValue, and a custom
one for setRating. The appropriate getters are also in place.
- As the rating is changed based on user selection I fire off the "rating"
KV notification. Yes, I know this rating is different than Object A. I have
also tried firing off the "objectValue" change notification in hopes that
the NSArrayController would be bound to that key in my object. nada ...
So the behavior I see is this:
1. When each cell is getting set up it first gets passed a value of null to
setObjectValue, then I see my getter method on Object A get called, and
finally the setObjectValue with the NSNumber from the rating method is set
on the NSCell. So why does it pass null in first? any ideas?
2. When I change the rating via the cell it reverts back to what it was set
to before that. I have tried notifying the "objectValue" binding that it
changed as stated above, there is no action/target set but I have that code
in place when there is one to notify that.
Essentially what I am doing is implementing the same thing as the
ClockControl example except now I'm trying to hook it up via KVB. Hope this
is enough details ... any suggestions or input anyone can give would be
fantastic.
Sean
_______________________________________________
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