Jump to content

Recommended Posts

Posted

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

Posted (edited)

; 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
Posted

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.)

  • 4 months later...

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
×
×
  • Create New...