On 2012 May 21, at 21:52, Quincey Morris wrote:

> This seems more or less the correct approach to defining a custom binding. 
> "More or less" because you may have committed some minor technical violation 
> of custom binding implementations, described unintelligibly in this document:
> 
>       
> https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html
> 
> However, it's not particularly clear what benefit it brings you to implement 
> a custom binding, since there's no practical way any more (AFAIK) to use 
> custom bindings in IB.

Thank you, Quincey.  Yes, I know about that – arghhh – IB limitation.  That's 
why I -bind:::: in the window controller's -awakeFromNib.

> With a code-based approach, it may be easier and clearer just to implement 
> the two halves of the behavior directly:

Yes, I see what you mean.  This may be one of those cases where Cocoa Bindings 
makes life more difficult instead of easier.

In this case, I kind of like the binding though, because all of the other 
fields in this Inspector window use bindings, and I'd rather not break the 
pattern.  I'll read "How Do Bindings Work" and see if I can find any "technical 
violations".

Jerry

(For sake of list archives, for anyone else who wants to try this, there's an 
important detail I left out of my original post.  Remember to -unbind: in the 
window controller's -windowWillClose or -dealloc, or you'll get exceptions 
and/or crashes.  I do it in both methods, calling a method which also removes 
other observers.  I use an instance variable, m_isObserving, to keep track of 
whether or not my bindings and observers are active.)
_______________________________________________

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