Jump to content
Sign in to follow this  
hmsSurprise

Read state of group radio buttons

Recommended Posts

hmsSurprise

The Sample GUI in the download has the following code to setup a pair of radio buttons. I would like to see an example of the standard way (AutoIt idiom) of checking which button is checked when the page is exited. Either mode would be OK.

Thanks,

jh

; GROUP WITH RADIO BUTTONS

GuiCtrlCreateGroup("Sample Group", 230, 120)

GuiCtrlCreateRadio("Radio One", 250, 140, 80)

GuiCtrlSetState(-1, $GUI_CHECKED)

GuiCtrlCreateRadio("Radio Two", 250, 165, 80)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

Share this post


Link to post
Share on other sites
Zedna

; GROUP WITH RADIO BUTTONS
GuiCtrlCreateGroup("Sample Group", 230, 120)
$radio1 = GuiCtrlCreateRadio("Radio One", 250, 140, 80)
GuiCtrlSetState(-1, $GUI_CHECKED)
$radio2 = GuiCtrlCreateRadio("Radio Two", 250, 165, 80)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

...

If IsChecked($radio1) Then ; ...
If IsChecked($radio2) Then ; ...

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc

Edited by Zedna

Share this post


Link to post
Share on other sites
hmsSurprise

Perfect. Thought I had seen other code that was 'bit anding' disparate fields, but this makes perfect sense.

Many thanks,

jh

(Sorry for tardy reply, been out sawing wood.)

Share this post


Link to post
Share on other sites
DavidA

Thank you Zedna, I am a new on AutoIT, and your solution also worked great for me!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.