Re: Solved: Re: Using multiple bindings to enable a button
Re: Solved: Re: Using multiple bindings to enable a button
- Subject: Re: Solved: Re: Using multiple bindings to enable a button
- From: Steve Mills <email@hidden>
- Date: Wed, 11 Feb 2015 14:27:41 -0600
On Feb 11, 2015, at 13:51:29, Ken Thomases <email@hidden> wrote:
>
> The selectedObjects property never returns those placeholders. Only the selection property does that. However, that wouldn't support @count, I don't think.
@count appears to work on selection when I tested it, FYI.
> I believe it should work to bind to selection.self or something similarly innocuous. Use the NSIsNotNil transformer to get a YES result by default. Then set the Multiple Values and No Selection placeholders to produce a different result for those cases.
>
> You probably want to enable Always Use Multi Value Marker on the array controller. By default, it compares the result of applying the model key path to all of the selected elements to see if they actually differ from each other. If they're all the same, it produces the single value. You've probably seen UIs where, if all selected objects have the same value, a checkbox reflects that one value. If they have different values, the checkbox shows the mixed state ([-]). This is what that's about. You don't care about that and, anyway, the "self" key is never going to be the same across multiple elements. You avoid a performance hit by enabling Always Use Multi Value Marker.
>
> However, this affects the array controller globally. You can't restrict it to just this one binding. So, be sure you don't want the default behavior anywhere else in your UI.
Aha, yes, these changes produce the desired effect. Cool beans! Thanks again!
--
Steve Mills
Drummer, Mac geek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden