Re: NSButton/NSBox interaction
Re: NSButton/NSBox interaction
- Subject: Re: NSButton/NSBox interaction
- From: Tom Doan <email@hidden>
- Date: Thu, 10 Apr 2014 15:30:17 -0500
- Priority: normal
Thanks for the help. Embedding each subset inside a custom view
did fix the problem. It would certainly have been nice to have the
NSButton class reference say something about the change, since it
should have been expected to break at least some existing
software.
> This is a Cocoa port of a Carbon app (and I also have Windows and GTK
> versions). My code assumes that I'm controlling the radio buttons,
> which has worked fine until now (apparently the 10.8 SDK). What I want
> is a radio style button which turns on when I want it on and turns off
> when I want it off and doesn't go off and manage itself along with the
> other buttons that the OS thinks (incorrectly in this case) are
> logically linked to it.
>
> Tom Doan
> Estima
>
> > > 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-AppK
> > it OlderNotes/>
> >
> > 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
>
>
> _______________________________________________
>
> 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
_______________________________________________
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