Jump to content

Need help in radio button and check box selection


alan lim
 Share

Recommended Posts

Hello,

I wanted to have application installation based on the selection as the scenario as shown below,

If 111 radio button is selected, then AAA and BBB will be auto checked on the check box.

If 222 radio button is selected, then BBB and CCC will be auto checked on the check box. The same sequence as 333 and 444.

During the selection, I also have an option to tick on any check box which is not checked. Example,

If 111 is select, then AAA and BBB will definitely be auto checked. At this moment, i have option to tick on CCC or DDD or both.

Finally, how many application will be installed is based on the Group1 selection.

I would appreciate someone could guide me or any sample that I can refer to. Thank you

Regards,

Alan Lim

post-1169-0-43019700-1347374200_thumb.jp

Edited by alan lim
Link to comment
Share on other sites

  • Moderators

Hi, alan lim. How about posting what you have thus far? We're not in the habit of writing code from scratch for you, but will gladly assist you with getting your code to work. Post whatever you have, even if it doesn't work, and we can help you modify it :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Hi, alan lim. The help file, along with the Wiki, are great places to start. I would begin with creating your GUI (GUICreate in the help file), and placing either the checkboxes (GUICtrlCreateCheckbox) or radio buttons (GUICtrlCreateRadio). Once you have that, you can look into the other aspects that you would like to accomplish. Once you have something, feel free to post here (even if it doesn't work quite like you'd like it to!) and we will be happy to asssist :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi jlogan3o13,

I managed to create a simple script which i have mentioned my intention for this script.

Currently, it only works if i click on radio button on the left and it will auto checked on the check box on the right.

But I could not get the result of the checked box on the left if i click on "install" button.

I hope you can help me. Big thank you.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=C:Usersalan ly limDesktopForm1_1_1.kxf
$Form1_1_1 = GUICreate("Form1", 616, 439, 192, 124)
$R_ASR = GUICtrlCreateRadio("Radio1", 30, 88, 13, 17)
$R_ADV = GUICtrlCreateRadio("Radio2", 30, 136, 13, 17)
$R_IAS7 = GUICtrlCreateRadio("Radio3", 30, 176, 13, 17)
$R_TAX = GUICtrlCreateRadio("Radio4", 30, 224, 13, 17)
$Label1 = GUICtrlCreateLabel("DEPT", 40, 40, 120, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("111", 88, 88, 80, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("222", 88, 136, 63, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("333", 88, 176, 40, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("444", 88, 224, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("Applications", 328, 32, 249, 377)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox("AAA", 360, 60, 13, 17)
$Checkbox2 = GUICtrlCreateCheckbox("BBB", 360, 90, 13, 17)
$Checkbox3 = GUICtrlCreateCheckbox("CCC", 360, 120, 13, 17)
$Checkbox4 = GUICtrlCreateCheckbox("DDD", 360, 150, 13, 17)
$Checkbox5 = GUICtrlCreateCheckbox("EEE", 360, 180, 13, 17)
$Checkbox6 = GUICtrlCreateCheckbox("FFF", 360, 210, 13, 17)
$Checkbox7 = GUICtrlCreateCheckbox("GGG", 360, 240, 13, 17)
$Checkbox8 = GUICtrlCreateCheckbox("HHH", 360, 270, 13, 17)
$Checkbox9 = GUICtrlCreateCheckbox("III", 360, 300, 13, 17)
$Checkbox10 = GUICtrlCreateCheckbox("JJJ", 360, 330, 13, 17)
$Checkbox11 = GUICtrlCreateCheckbox("KKK", 360, 360, 13, 17)
$Label6 = GUICtrlCreateLabel("AAA", 384, 60, 32, 20)
$Label7 = GUICtrlCreateLabel("BBB", 384, 90, 30, 20)
$Label8 = GUICtrlCreateLabel("CCC", 384, 120, 66, 20)
$Label9 = GUICtrlCreateLabel("DDD", 384, 150, 55, 20)
$Label10 = GUICtrlCreateLabel("EEE", 384, 180, 142, 20)
$Label11 = GUICtrlCreateLabel("FFF", 384, 210, 43, 20)
$Label12 = GUICtrlCreateLabel("GGG", 384, 240, 43, 20)
$Label13 = GUICtrlCreateLabel("HHH", 384, 270, 59, 20)
$Label14 = GUICtrlCreateLabel("III", 384, 300, 40, 20)
$Label15 = GUICtrlCreateLabel("JJJ", 384, 330, 50, 20)
$Label16 = GUICtrlCreateLabel("KKK", 384, 360, 120, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$InstallButton = GUICtrlCreateButton("Install", 16, 312, 75, 25)
$Button2 = GUICtrlCreateButton("Cancel", 144, 312, 75, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE, $Button2
   _Cancel()
  Case $R_ASR
   If GUICtrlRead($R_ASR, $GUI_Checked) Then
    _UNChecked_ALL()
    GUICtrlSetState($Checkbox1, $GUI_Checked) ; Aura
    GUICtrlSetState($Checkbox4, $GUI_Checked) ; MyClient
    GUICtrlSetState($Checkbox7, $GUI_Checked) ; Retain
   EndIf
  Case $R_ADV
   If GUICtrlRead($R_ADV, $GUI_Checked) Then
    _UNChecked_ALL()
    GUICtrlSetState($Checkbox7, $GUI_Checked) ; Retain
    GUICtrlSetState($Checkbox8, $GUI_Checked) ; Smart 3.0
   EndIf
  Case $R_IAS7
   If GUICtrlRead($R_IAS7, $GUI_Checked) Then
    _UNChecked_ALL()
    GUICtrlSetState($Checkbox3, $GUI_Checked) ; Dynadock
    GUICtrlSetState($Checkbox5, $GUI_Checked) ; Nuance PDC Converter
    GUICtrlSetState($Checkbox6, $GUI_Checked) ; Pertax
   EndIf
  Case $R_TAX
   If GUICtrlRead($R_Tax, $GUI_Checked) Then
    _UNChecked_ALL()
    GUICtrlSetState($Checkbox2, $GUI_Checked) ; Ctax
    GUICtrlSetState($Checkbox9, $GUI_Checked) ; Team
    GUICtrlSetState($Checkbox10, $GUI_Checked) ; TLSinfo
   EndIf
EndSwitch
WEnd
Func _Install($Program)
    If $Program = 0 Then
        MsgBox(4096, "Install", "App1")
    ElseIf $Program = 1 Then
        MsgBox(4096, "Install", "App2")
    ElseIf $Program = 2 Then
        MsgBox(4096, "Install", "App3")
    ElseIf $Program = 3 Then
        MsgBox(4096, "Install", "App4")
    ElseIf $Program = 4 Then
        MsgBox(4096, "Install", "App5")
    ElseIf $Program = 5 Then
        MsgBox(4096, "Install", "App6")
    ElseIf $Program = 6 Then
        MsgBox(4096, "Install", "App7")
    EndIf
EndFunc

Func _UNChecked_ALL()
;~  MsgBox(0,"","unchecked")
GUICtrlSetState($Checkbox1, $GUI_UnChecked)
GUICtrlSetState($Checkbox2, $GUI_UnChecked)
GUICtrlSetState($Checkbox3, $GUI_UnChecked)
GUICtrlSetState($Checkbox4, $GUI_UnChecked)
GUICtrlSetState($Checkbox5, $GUI_UnChecked)
GUICtrlSetState($Checkbox6, $GUI_UnChecked)
GUICtrlSetState($Checkbox7, $GUI_UnChecked)
GUICtrlSetState($Checkbox8, $GUI_UnChecked)
GUICtrlSetState($Checkbox9, $GUI_UnChecked)
GUICtrlSetState($Checkbox10, $GUI_UnChecked)
GUICtrlSetState($Checkbox11, $GUI_UnChecked)
EndFunc   ;==>UNChecked_ALL
Func _Cancel()
  Local $Cancel
    $Cancel = MsgBox(262452,"Cancel","Are you sure you want to Cancel?")
    If $Cancel = 6 Then
    Exit
    Endif
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...