FROM : Ricky Sharp
DATE : Mon Apr 04 20:45:46 2005
On Monday, April 04, 2005, at 01:11PM, Brian O'Brien <<email_removed>> wrote:
>I have a few radio buttons on my application.
>I set up actions to handle events from these buttons.
>I am wondering how I can get the currently selected value of the radio
>button.
>Also I'm wondering if maybe they should have been setup as outlets...
I'm not sure why you'd want to have your buttons fire some action; usually they are to allow the user to make a mutually exclusive choice.
Are you using the actions to set something in your model (i.e. which choice the user has selected)? In that case, if not using bindings, see selectedCell in NSMatrix. Once you get the cell, you can obtain its tag by sending it a tag message.
If using bindings, just bind selectedTag or selectedIndex. I tend to use the former as it shields me from the physical order of the radio buttons.
--
Rick Sharp
Instant Interactive(tm)
DATE : Mon Apr 04 20:45:46 2005
On Monday, April 04, 2005, at 01:11PM, Brian O'Brien <<email_removed>> wrote:
>I have a few radio buttons on my application.
>I set up actions to handle events from these buttons.
>I am wondering how I can get the currently selected value of the radio
>button.
>Also I'm wondering if maybe they should have been setup as outlets...
I'm not sure why you'd want to have your buttons fire some action; usually they are to allow the user to make a mutually exclusive choice.
Are you using the actions to set something in your model (i.e. which choice the user has selected)? In that case, if not using bindings, see selectedCell in NSMatrix. Once you get the cell, you can obtain its tag by sending it a tag message.
If using bindings, just bind selectedTag or selectedIndex. I tend to use the former as it shields me from the physical order of the radio buttons.
--
Rick Sharp
Instant Interactive(tm)
| Related mails | Author | Date |
|---|---|---|
| Brian O'Brien | Apr 4, 20:12 | |
| Ricky Sharp | Apr 4, 20:45 |






Cocoa mail archive

