> On Oct 9, 2014, at 21:13, Ken Thomases <k...@codeweavers.com> wrote:
> 
> On Oct 9, 2014, at 10:56 PM, Randy Widell <randy.wid...@gmail.com> wrote:
> 
>> I’m not sure I am having a hard time figuring this out and I am just not 
>> finding anything via Google.  I am writing a NSTextFieldCell subclass and I 
>> want to recalculate the size whenever the string value changes via a 
>> binding.  What I can’t seem to figure out is how to observe the change.  I 
>> could register each instance with itself for change notifications, but that 
>> just seems like an odd way to go about it.  Seems like it should be possible 
>> to just override setValue:forKeyPath:, but that never seems to be called.
> 
> I would expect that the control will call -setObjectValue: on the cell when 
> it (the control) receives a new value via the binding.
> 
> It may not be the case that the control ever gets -setValue:forKey: when the 
> property to which it is bound changes.  That's one possible way for the 
> implementation to work, but as least as likely is for the control to have 
> -observeValueForKeyPath:… to be called on it because it was using KVO to 
> observe the property to which it is bound.
> 
> In any case, the cell should be entirely insulated from the way in which the 
> control received its new value.  When implementing a cell, you should not 
> need to care about bindings or whatever.
> 
> Regards,
> Ken
> 

Oh, man, thanks.  I knew it had to be something straightforward.  Yeah, the 
whole KVO route seemed like a weird way to go about it.  Went down the wrong 
rabbit hole.  Thanks!
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to