FROM : Steven Huey
DATE : Sat Apr 26 13:51:26 2008
Alli,
Off hand I'm not sure of any sample code, but if you're using the
Radio Group from Interface Builder, you'll want to look at the
documentation for the NSMatrix class.
http://developer.apple.com/documentation/Cocoa/Conceptual/Matrix/Matrix.html
In my code I typically set the "tag" values for each of the individual
radio buttons within the NSMatrix instance, and then create an outlet
in my controller like:
IBOutlet NSMatrix *myRadioGroup;
You can then get the text of the selected radio button using:
[[myRadioGroup selectedCell] title]
You can fetch a specific cell of the matrix using:
[myRadioGroup cellWithTag:3] // 3 is a tag value
You can programmatically select a specific cell using:
[myRadioGroup selectCellWithTag:3]
If that doesn't get you started or no one else has more sample code
for you, contact me off list and I can probably come up with a quick
code example for you.
Best regards,
Steven Huey
On Apr 26, 2008, at 6:38 AM, Allison Newman wrote:
> Could somebody please put me out of my misery and tell me where I
> can find an example of using radio buttons in a Cocoa app please?
> Or better yet, a tutorial? I have just wasted several hours of my
> life trying to find one, because I can not make the sodding things
> to work!!
>
> thanks,
>
> Alli
--
Steven Huey Software - http://www.stevenhuey.com
DATE : Sat Apr 26 13:51:26 2008
Alli,
Off hand I'm not sure of any sample code, but if you're using the
Radio Group from Interface Builder, you'll want to look at the
documentation for the NSMatrix class.
http://developer.apple.com/documentation/Cocoa/Conceptual/Matrix/Matrix.html
In my code I typically set the "tag" values for each of the individual
radio buttons within the NSMatrix instance, and then create an outlet
in my controller like:
IBOutlet NSMatrix *myRadioGroup;
You can then get the text of the selected radio button using:
[[myRadioGroup selectedCell] title]
You can fetch a specific cell of the matrix using:
[myRadioGroup cellWithTag:3] // 3 is a tag value
You can programmatically select a specific cell using:
[myRadioGroup selectCellWithTag:3]
If that doesn't get you started or no one else has more sample code
for you, contact me off list and I can probably come up with a quick
code example for you.
Best regards,
Steven Huey
On Apr 26, 2008, at 6:38 AM, Allison Newman wrote:
> Could somebody please put me out of my misery and tell me where I
> can find an example of using radio buttons in a Cocoa app please?
> Or better yet, a tutorial? I have just wasted several hours of my
> life trying to find one, because I can not make the sodding things
> to work!!
>
> thanks,
>
> Alli
--
Steven Huey Software - http://www.stevenhuey.com
| Related mails | Author | Date |
|---|---|---|
| Allison Newman | Apr 26, 12:38 | |
| Steven Huey | Apr 26, 13:51 | |
| Bill Mutch | Apr 27, 16:29 |






Cocoa mail archive

