bloopie

Get state of multiple Radio Buttons

13 posts in this topic

Hello again,

I'm writing a pretty simple GUI and script to help out some other colleagues. ...The GUI has currently 4 Radio Buttons, a combobox, an input box (which I will probably remove), and a Button. I would like to add a msgbox if no Radio Buttons have been checked when the Button is pressed...this sounds very simple but I'm not sure how I should be doing it! :>

I've tried a few things already... If GuiCtrlRead(box1)=$GUI_CHECKED And GuiCtrlRead(box2)=$GUI_CHECKED And (same for box 3 and 4, they all = Checked) Then msgbox(0,0, "blah, blah, blah")

I've tried different wording of the above (i.e. "And Not $GUI_UNCHECKED"), as well as using variables to cut down on the code....and one other method as well...but I just can't get the msgbox to come up only when the button is pressed AND NO radio's are checked. Can someone please point me in the right direction, and/or suggest some better methods?? It would be much appreciated!  Here is an obfuscated version of the GUI I have:
 

#include <IE.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{f1}", "Terminate")


Global $Vendor = 'http://172.16.128.1/vendors.html'
Global $Combo
Global $idComboRead = GUICtrlRead($Combo)


#Region ### START Koda GUI section ### Form=C:\Users\****\Desktop\KODA.kxf
$Form1 = GUICreate("Press F1 to Exit!",@DesktopWidth, (@DesktopHeight-55))
Global $Input1 = GUICtrlCreateInput("", 40, 48, 161, 21)
GUICtrlSetCursor (-1, 5)
$Label1 = GUICtrlCreateLabel("Please Enter Part Number Below", 40, 24, 158, 17)
Global $GOButton = GUICtrlCreateButton("GO", 280, 32, 97, 25)
GUICtrlSetCursor (-1, 0)
Global $GWC = GUICtrlCreateRadio("GWC", 480, 30, 57, 17)
Global $ARC = GUICtrlCreateRadio("ARC", 480, 55, 73, 17)
Global $WAWHAW = GUICtrlCreateRadio("Wood", 592, 30, 99, 17)
$Combo = GUICtrlCreateCombo("default loc", 800, 32, 201, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Combo,"location1|location2|location3|location4|location5", "default loc")
Global $Primo = GUICtrlCreateRadio("Primo", 592, 55, 97, 17)
Global $Group1 = GUICtrlCreateGroup("WAREHOUSE", 456, 5, 265, 75)
GUICtrlSetFont(-1, 10, 900, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $oIE = _IECreateEmbedded()
Global $Object = GUICtrlCreateObj($oIE,10,100,(@DesktopWidth-20),(@DesktopHeight-128))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#cs
Global $wrhse1 = GUICtrlRead($GWC)  ;used the wrhseX variables unsuccessfully
Global $wrhse2 = GUICtrlRead($ARC)
Global $wrhse3 = GUICtrlRead($WAWHAW)
Global $wrhse4 = GUICtrlRead($Primo)
#ce


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $WAWHAW
            Local $answer1 = MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_TASKMODAL, 'Wood', 'Clicking "YES" will log in with the *** account!' & @CRLF & @CRLF & 'Do you want to log in with the *** Account?', 15)
            If $answer1 = $IDYES Then
                _IENavigate($oIE, "about:blank")
                _IENavigate($oIE, $Vendor)
                _IELinkClickByIndex($oIE, 14)
            Else
                ContinueLoop
            EndIf
        Case $Primo
            Local $answer2 = MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_TASKMODAL, 'Primo', 'Clicking "YES" will log in with the *** account!' & @CRLF & @CRLF & 'Do you want to log in with the *** Account?', 15)
            If $answer2 = $IDYES Then
                _IENavigate($oIE, "about:blank")
                _IENavigate($oIE, $Vendor)
                _IELinkClickByIndex($oIE, 11)
            Else
                ContinueLoop
            EndIf
        Case $GOButton
            GO_Button()
    EndSwitch
WEnd


Func GO_Button()
    If GUICtrlRead($Combo) = "location1" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 5)
    ElseIf GUICtrlRead($Combo) = "Default loc" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 6)
    ElseIf GUICtrlRead($Combo) = "location2" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 7)
    ElseIf GUICtrlRead($Combo) = "location3" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 8)
    ElseIf GUICtrlRead($Combo) = "location4" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 9)
    ElseIf GUICtrlRead($Combo) = "location1" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 0)
    ElseIf GUICtrlRead($Combo) = "Default loc" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 1)
    ElseIf GUICtrlRead($Combo) = "location2" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 2)
    ElseIf GUICtrlRead($Combo) = "location3" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 3)
    ElseIf GUICtrlRead($Combo) = "location4" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Only existing accounts will load!!", 15)
    ElseIf GUICtrlRead($Combo) = "Monroe" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Only existing accounts will load!!", 15)
    ElseIf GUICtrlRead($Combo) = "Spring Valley" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Use *** account for GWC/locationX!!", 15)
    EndIf
EndFunc

Func Terminate()
    Exit
EndFunc

bloopie

Share this post


Link to post
Share on other sites



8 minutes ago, bloopie said:

Here is an obfuscated version of the GUI I have

When you need help, why posting obfuscated version?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The only thing hidden are names of variables...nothing dependent on the function. I wouldn't have posted it if it wasn't the functions I was using. ...And disregard "Monroe" and "Spring Valley", those can be any "locationX". :)

Edited by bloopie

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@bloopie,

1st easiest solution: pre-check one of the radio options as default.

2nd easiest solution: start with the button disabled. when you process $msg, if a message came from one of the radio options then it means it was checked, so enable the button. this can be done only once; a user cannot un-check all radio options. like this:

#include <IE.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{f1}", "Terminate")


Global $Vendor = 'http://172.16.128.1/vendors.html'
Global $Combo
Global $idComboRead = GUICtrlRead($Combo)


#Region ### START Koda GUI section ### Form=C:\Users\****\Desktop\KODA.kxf
$Form1 = GUICreate("Press F1 to Exit!", @DesktopWidth, (@DesktopHeight - 55))
Global $Input1 = GUICtrlCreateInput("", 40, 48, 161, 21)
GUICtrlSetCursor(-1, 5)
$Label1 = GUICtrlCreateLabel("Please Enter Part Number Below", 40, 24, 158, 17)
Global $GOButton = GUICtrlCreateButton("GO", 280, 32, 97, 25)
GUICtrlSetCursor(-1, 0)
GUICtrlSetState(-1, $GUI_DISABLE) ; >>>>> ADDED
Global $GWC = GUICtrlCreateRadio("GWC", 480, 30, 57, 17)
Global $ARC = GUICtrlCreateRadio("ARC", 480, 55, 73, 17)
Global $Primo = GUICtrlCreateRadio("Primo", 592, 55, 97, 17)
Global $WAWHAW = GUICtrlCreateRadio("Wood", 592, 30, 99, 17) ; moved here from two lines below, to create all radio optinos in sequence
$Combo = GUICtrlCreateCombo("default loc", 800, 32, 201, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Combo, "location1|location2|location3|location4|location5", "default loc")
Global $Group1 = GUICtrlCreateGroup("WAREHOUSE", 456, 5, 265, 75)
GUICtrlSetFont(-1, 10, 900, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $oIE = _IECreateEmbedded()
Global $Object = GUICtrlCreateObj($oIE, 10, 100, (@DesktopWidth - 20), (@DesktopHeight - 128))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#cs
Global $wrhse1 = GUICtrlRead($GWC)  ;used the wrhseX variables unsuccessfully
Global $wrhse2 = GUICtrlRead($ARC)
Global $wrhse3 = GUICtrlRead($WAWHAW)
Global $wrhse4 = GUICtrlRead($Primo)
#ce


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $WAWHAW
            GUICtrlSetState($GOButton, $GUI_ENABLE) ; >>>>> ADDED
            Local $answer1 = MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_TASKMODAL, 'Wood', 'Clicking "YES" will log in with the *** account!' & @CRLF & @CRLF & 'Do you want to log in with the *** Account?', 15)
            If $answer1 = $IDYES Then
                _IENavigate($oIE, "about:blank")
                _IENavigate($oIE, $Vendor)
                _IELinkClickByIndex($oIE, 14)
            Else
                ContinueLoop
            EndIf
        Case $Primo
            GUICtrlSetState($GOButton, $GUI_ENABLE) ; >>>>> ADDED
            Local $answer2 = MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_TASKMODAL, 'Primo', 'Clicking "YES" will log in with the *** account!' & @CRLF & @CRLF & 'Do you want to log in with the *** Account?', 15)
            If $answer2 = $IDYES Then
                _IENavigate($oIE, "about:blank")
                _IENavigate($oIE, $Vendor)
                _IELinkClickByIndex($oIE, 11)
            Else
                ContinueLoop
            EndIf
        Case $GWC, $ARC ; >>>>> ADDED
            GUICtrlSetState($GOButton, $GUI_ENABLE) ; >>>>> ADDED
        Case $GOButton
            GO_Button()
    EndSwitch
WEnd


Func GO_Button()
    If GUICtrlRead($Combo) = "location1" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 5)
    ElseIf GUICtrlRead($Combo) = "Default loc" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 6)
    ElseIf GUICtrlRead($Combo) = "location2" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 7)
    ElseIf GUICtrlRead($Combo) = "location3" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 8)
    ElseIf GUICtrlRead($Combo) = "location4" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 9)
    ElseIf GUICtrlRead($Combo) = "location1" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 0)
    ElseIf GUICtrlRead($Combo) = "Default loc" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 1)
    ElseIf GUICtrlRead($Combo) = "location2" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 2)
    ElseIf GUICtrlRead($Combo) = "location3" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        _IENavigate($oIE, "about:blank")
        _IENavigate($oIE, $Vendor)
        _IELinkClickByIndex($oIE, 3)
    ElseIf GUICtrlRead($Combo) = "location4" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Only existing accounts will load!!", 15)
    ElseIf GUICtrlRead($Combo) = "Monroe" And GUICtrlRead($ARC) = $GUI_CHECKED Then
        MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Only existing accounts will load!!", 15)
    ElseIf GUICtrlRead($Combo) = "Spring Valley" And GUICtrlRead($GWC) = $GUI_CHECKED Then
        MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Use *** account for GWC/locationX!!", 15)
    EndIf
EndFunc   ;==>GO_Button

Func Terminate()
    Exit
EndFunc   ;==>Terminate

look for the lines ending with a comment ; >>>>> ADDED

also, this may prove an interesting reading (start from the end):

 

Edited by orbs
1 person likes this

Share this post


Link to post
Share on other sites

Hello orbs, and thanks very much for your insight!!!

Quote

1st easiest solution: pre-check one of the radio options as default.

Yes, I was aware of this, and know it would be super easy to do...but I could foresee some people logging in to the wrong accounts that way, so I really don't want to have a default radio checked (sorry, I should have mentioned that in advance).

However, disabling the "Go" button is certainly an option that could work...thanks for that!

The link to the other topic is also full of good info I hadn't exactly read elsewhere, so thanks again very much! :)

I was thinking of looping through the radio buttons as well, but haven't yet thought of the proper way to do it that would work for my purposes. What you have proposed in the other topic is a great idea, and that may work...if I loop through all radio buttons only once when "Go" is pressed, and then return a msgbox if none are checked...that sounds like it might work, but I'm not sure how...yet....but I'll work on that too next chance I have.

==========

I'm going to see what I can do with all the good information you have provided for me. Thank you very much for your very helpful reply! :)

bloopie

Share this post


Link to post
Share on other sites

Sounds like you need to do a little reading on combinational logic.  From your description, I think you would want to AND together the GUI_UNCHECKED state of the buttons, not the GUI_CHECKED state.

Basically, you want something like this:  I re-ordered things a bit for less repeating of the same check, and then added an else-if at the bottom that I think is what you want.  By the time that else-if is reached, you know two radio buttons aren't checked, so you only need to see that the other two are unchecked before popping up the msgbox.
 

Func GO_Button()
    If GUICtrlRead($GWC) = $GUI_CHECKED Then
        ; this part could be a switch clause also
        If GUICtrlRead($Combo) = "location1" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 5)
        ElseIf GUICtrlRead($Combo) = "Default loc" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 6)
        ElseIf GUICtrlRead($Combo) = "location2" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 7)
        ElseIf GUICtrlRead($Combo) = "location3" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 8)
        ElseIf GUICtrlRead($Combo) = "location4" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 9)
        ElseIf GUICtrlRead($Combo) = "Spring Valley" Then
           MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Use *** account for GWC/locationX!!", 15)
        EndIf
    ElseIf GUICtrlRead($ARC) = $GUI_CHECKED Then
        If GUICtrlRead($Combo) = "location1" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 0)
        ElseIf GUICtrlRead($Combo) = "Default loc" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 1)
        ElseIf GUICtrlRead($Combo) = "location2" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 2)
        ElseIf GUICtrlRead($Combo) = "location3" Then
          _IENavigate($oIE, "about:blank")
          _IENavigate($oIE, $Vendor)
          _IELinkClickByIndex($oIE, 3)
        ElseIf GUICtrlRead($Combo) = "location4" Then
          MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Only existing accounts will load!!", 15)
        ElseIf GUICtrlRead($Combo) = "Monroe" Then
          MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & "Only existing accounts will load!!", 15)
        Endif
    ElseIf GUICtrlRead($Primo) = $GUI_UNCHECKED And GUICtrlRead($WAWHAW) = $GUI_UNCHECKED Then
       MsgBox ($MB_OK, "Error", "Please select a location")
    EndIf
EndFunc

 

Share this post


Link to post
Share on other sites

Also, NOT $GUI_UNCHECKED is the same thing as $GUI_CHECKED. 

I.e. Not False = True

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

But really, this is the way I would do it:

Func GO_Button()

    If GUICtrlRead($Primo) = $GUI_UNCHECKED And GUICtrlRead($GWC) = $GUI_UNCHECKED And GUICtrlRead($ARC) = $GUI_UNCHECKED And GUICtrlRead($Primo) = $GUI_UNCHECKED Then
        MsgBox ($MB_OK, "Error", "Please select a location")
    Else

        Local $IndexToClick = -1
        Local $AccountMsg
        
        If GUICtrlRead($GWC) = $GUI_CHECKED Then
            If GUICtrlRead($Combo) = "location1" Then
                $IndexToClick = 5
            ElseIf GUICtrlRead($Combo) = "Default loc" Then
                $IndexToClick = 6
            ElseIf GUICtrlRead($Combo) = "location2" Then
                $IndexToClick = 7
            ElseIf GUICtrlRead($Combo) = "location3" Then
                $IndexToClick = 8
            ElseIf GUICtrlRead($Combo) = "location4" Then
                $IndexToClick = 9
            ElseIf GUICtrlRead($Combo) = "Spring Valley" Then
                $AccountMsg = "Use *** account for GWC/locationX!!"
            EndIf
        ElseIf GUICtrlRead($ARC) = $GUI_CHECKED Then
            If GUICtrlRead($Combo) = "location1" Then
                $IndexToClick = 0
            ElseIf GUICtrlRead($Combo) = "Default loc" Then
                $IndexToClick = 1
            ElseIf GUICtrlRead($Combo) = "location2" Then
                $IndexToClick = 2
            ElseIf GUICtrlRead($Combo) = "location3" Then
                $IndexToClick = 3
            ElseIf GUICtrlRead($Combo) = "location4" Then
                $AccountMsg = "Only existing accounts will load!!"
            ElseIf GUICtrlRead($Combo) = "Monroe" Then
                $AccountMsg = "Only existing accounts will load!!"
            Endif
        ElseIf GUICtrlRead($Primo) = $GUI_CHECKED Then
            ; handle $Primo location
        ElseIf GUICtrlRead($WAWHAW) = $GUI_CHECKED Then
            ; handle $WAWHAW location
        EndIf

        If $IndexToClick = -1 Then
            MsgBox($MB_ICONWARNING + $MB_TASKMODAL, 'ERROR!!', "Account does not exist!!" & @CRLF & @CRLF & $AccountMsg, 15)
        Else
           _IENavigate($oIE, "about:blank")
           _IENavigate($oIE, $Vendor)
           _IELinkClickByIndex($oIE, $IndexToClick)
        EndIf
    EndIf
EndFunc

 

Edited by quickbeam
Removed empty Else clause

Share this post


Link to post
Share on other sites

@quickbeam  Small suggestion, read once, eval many:

;untested
Func GO_Button()
    Local $iStatePrimo = GUICtrlRead($Primo), $iStateGWC = GUICtrlRead(@GWC), $iStateARC = GUICtrlRead($ARC)
    ;If GUICtrlRead($Primo) = $GUI_UNCHECKED And GUICtrlRead($GWC) = $GUI_UNCHECKED And GUICtrlRead($ARC) = $GUI_UNCHECKED And GUICtrlRead($Primo) = $GUI_UNCHECKED Then
    If $iStatePrimo = $GUI_UNCHECKED And $iStateGWC = $GUI_UNCHECKED And $iStateARC = $GUI_UNCHECKED Then
        MsgBox ($MB_OK, "Error", "Please select a location")
    Else

        Local $IndexToClick = -1
        Local $AccountMsg
        Local $sValueCombo = GUICtrlRead($Combo)
        
        If $iStateGWC = $GUI_CHECKED Then
            If $sValueCombo = "location1" Then
                $IndexToClick = 5
            ElseIf $sValueCombo = "Default loc" Then
                $IndexToClick = 6
            ElseIf $sValueCombo = "location2" Then
                $IndexToClick = 7
;...etc

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

Good point.  I was on that path (compared to the original), but you took it an additional step.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

@quickbeam

Quote

Sounds like you need to do a little reading on combinational logic.  From your description, I think you would want to AND together the GUI_UNCHECKED state of the buttons, not the GUI_CHECKED state.

 
 

Actually, no...I mentioned in my first post, I have tried both the $GUI_CHECKED and the $GUI_UNCHECKED states...neither worked. I'm quite sure I understand conditional logic just fine (I'm a malware removal instructor in which conditional logic is used more often than you'd think ;)), but I really do appreciate the additional way of going about the issue, thanks very much for that (spudw2k included)! :)

My testing time is very limited currently, but I will work a bit with that and let you know how it goes. Thanks again.

bloopie

Edited by bloopie

Share this post


Link to post
Share on other sites

#12 ·  Posted

On ‎10‎/‎19‎/‎2016 at 6:18 PM, bloopie said:

I'm a malware removal instructor

This is a job?

kylomas


Forum Rules         Procedure for posting code

Share this post


Link to post
Share on other sites

#13 ·  Posted

15 hours ago, kylomas said:

This is a job?

 

This is a hobby...but it may as well be a job considering the time committed. :lol:

bloopie

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