Re: Alternatives to NSMatrix that uses bindings similar to NSMatrix's bindings
Re: Alternatives to NSMatrix that uses bindings similar to NSMatrix's bindings
- Subject: Re: Alternatives to NSMatrix that uses bindings similar to NSMatrix's bindings
- From: Graham Cox <email@hidden>
- Date: Fri, 08 Apr 2016 09:34:10 +1000
> On 8 Apr 2016, at 9:23 AM, Graham Cox <email@hidden> wrote:
>
>
>> On 8 Apr 2016, at 5:36 AM, Nivek Research <email@hidden> wrote:
>>
>> I have a number of NSMatrix instances that group radio buttons. Most bind the selectedIndex or selectedTag bindings available on NSMatrix to a numeric value in a model object. The others bind the contentObjects and selectedObject binding available on NSMatrix. As NSMatrix is informally deprecated in OS X 10.8 and later does anyone know a way to bind multiple NSRadioButtons to a single numeric value as was once done with selectedIndex or selectedTag such that the selected radio button follows the numeric value? Similarly does anyone have a way to bind multiple buttons to a single object value like NSMatrix’s selectedObject was used previously? Ideally any solution should be backwards compatible to OS X 10.6 as I still need to support that release. I have searched the internet though I have not seen a solution that will work without major changes to my model code. Not that I am not willing to make the changes. I just wonder if anyone has been enlightened with a cooler solution.
>
> If you have a bunch of “naked” radio buttons, all having the same target and selector (but presumably different tags, so you can distinguish them), they will automatically act as a group. This behaviour came in at some point in the mid OS X era, say 10.5/10.6, so isn’t universal, but it’s less bother than messing about with NSMatrix. If you need to set one programatically, just keep outlets to the individual buttons.
Also, they have to all be subviews of the same parent view.
Strangely, I can’t find anything in the documentation about this, but it most definitely works.
—Graham
_______________________________________________
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