Re: Stupid newbie question...
Re: Stupid newbie question...
- Subject: Re: Stupid newbie question...
- From: Shawn Erickson <email@hidden>
- Date: Thu, 26 May 2005 15:47:57 -0700
On May 26, 2005, at 3:12 PM, Shawn Erickson wrote:
On May 26, 2005, at 3:02 PM, Brian O'Brien wrote:
I have two radio buttons and I can't figure out how to find out
which state the set is in...
The object thats passed to my action is an NSMatrix.
I assume this is a matrix of buttons and I guess I'm supposed to
be able to go through each one and figure out
which is the currently selected button..
Help?
The programming topic "Matrices" linked from the NSMatrix API docs
has a section that talks about "Matrix Selection modes" and in
particular...
"NSRadioModeMatrix is used when you want no more than one NSCell to
be selected at a time. It can be used to create a set of buttons of
which one and only one is selected. (There’s also the option of
allowing no button to be selected.) Any time an NSCell is selected,
the previously selected NSCell is unselected. This is most commonly
used with groups of radio buttons. You might also use it with a
group of push buttons that you want to behave like radio buttons."
Knowing the behavior outlined for radio mode matrices use
"selectedCell" to get the currently selected cell and then ask that
cell for its tag to understand which it is (or various other
methods of understanding that).
I forgot about NSControl's selectedTag and selectedCell methods
(NSMatrix inherits from NSControl) consider using those.
Also I wanted to note that NSCell instances can represent an object
and that may make more sense depending on what you are doing, see the
following for more information...
<http://developer.apple.com/documentation/Cocoa/Conceptual/
ControlCell/Concepts/RepresentedObjects.html#//apple_ref/doc/uid/
20000067>
-Shawn _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden