> On Nov 22, 2014, at 03:17 , Jerry Krinock <je...@ieee.org> wrote:
> 
> 
>> On 2014 Nov 21, at 19:09, Rick Mann <rm...@latencyzero.com> wrote:
>> 
>> In an OS X app I have an NSTableView that binds to an array of Job objects. 
>> I'd like to have a checkbox column that the user can check that indicates 
>> the "active" job. There should be only one of these. Is there a way to bind 
>> the value of that column to something other than the Job for that row, to 
>> handle this?
> 
> This uniqueness of the “active” job seems to me like it belongs in your data 
> model, not your view controller.

It is in the data model. But it's currently smelly. When the active property 
gets set, that entity checks with the AppDelegate (it could be any object) to 
see who the currently-active instance was, and unsets that one. I don't like 
having my model know about the AppDelegate, but I don't see a way to bind to 
something else directly and say "if I am the same as this other thing, then 
check the widget. If the widget gets checked, make me the active thing on this 
other thing."

> 
> If this is a quickie project, implementing the uniqueness in an IBAction 
> method, as discussed yesterday, is a quick fix that will work.
> 
> But for long-term projects that might in the future support, say, other views 
> or scripting, Cocoa Bindings can be used to provide a more disciplined 
> model-view-controller separation.  Cocoa Bindings do have a development cost, 
> quite a bit of baggage, but you’re already using Cocoa Bindings in this 
> project anyhow.
> 
> 
> _______________________________________________
> 
> 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/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


-- 
Rick Mann
rm...@latencyzero.com



_______________________________________________

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