Re: NSButton/NSBox interaction
Re: NSButton/NSBox interaction
- Subject: Re: NSButton/NSBox interaction
- From: Kyle Sluder <email@hidden>
- Date: Thu, 10 Apr 2014 09:03:44 -0700
> On Apr 10, 2014, at 6:57 AM, Keary Suska <email@hidden> wrote:
>
>> On Apr 9, 2014, at 5:30 PM, Graham Cox wrote:
>>
>> I'm not exactly certain of the mechanism, but I think radio buttons interact as a set through the agency of their immediate superview, so if several buttons share it, they are assumed to be part of the same set.
>>
>> So you can embed the separate sets into container views or NSMatrix, and they'll work as you want. You mention NOT putting them into a NSMatrix for some reason - what reason? That's the usual way to set up radios, though it comes with the added restriction that the buttons have to be laid out on a regular grid. But embedding them in a custom view that draws nothing should also work, and that has no such limitation.
>
>
> That would be great functionality that I have often desired but AFAICT that is not the case--at least I am unable to replicate it. Or do you mean multiple radio-type NSButtonCells in a single view? That would make sense but only NSMatrix has that functionality built-in, AFAIK.
I think Graham is referring to this feature, added in 10.8:
> An NSButton configured as a radio button (with the -buttonType set to NSRadioButton), will now operate in a radio button group for applications linked on 10.8 and later. To have the button work in a radio group, use the same -action for each NSButton instance, and have the same superview for each button. When these conditions are met, checking one button (by changing the -state to 1), will uncheck all other buttons (by setting their -state to 0).
<https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/>
Tom, are you sure that your two sets of radio buttons use different actions?
--Kyle Sluder
_______________________________________________
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