Jump to content

Recommended Posts

Posted

Given the following simple GUI example below (which does nothing at all), is it possible to read the value using the group ?

Something like

_GUICtrl_Group_GetChecked($groupname)

.. and have the status of either checkbox(es) as array, or radiobutton as f.ex an index ?

I tried to find a UDF or similar, but no luck so far. Right now I have to loop each checkbox and check against bitor.. etc.

Alternatively, maybe just a simple

if ischk($checkbox) then ...

; Code below for demo GUI.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
; First group
$Label1 = GUICtrlCreateLabel("Select any:", 32, 96, 57, 17)
$Group1 = GUICtrlCreateGroup("Group1", 32, 128, 129, 201)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 152, 97, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 48, 176, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 48, 208, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 48, 240, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)


; Second group
$Label2 = GUICtrlCreateLabel("Select one:", 232, 96, 58, 17)
$Group2 = GUICtrlCreateGroup("Group2", 224, 128, 233, 201)
$Radio1 = GUICtrlCreateRadio("Radio1", 240, 144, 185, 33)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("Radio2", 240, 176, 113, 17)
$Radio3 = GUICtrlCreateRadio("Radio3", 240, 206, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

; a button
$Button1 = GUICtrlCreateButton("Show Results", 352, 368, 201, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

I am just a hobby programmer, and nothing great to publish right now.

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