Sign in to follow this  
Followers 0
byteme

loop within a gui

3 posts in this topic

Hi Everybody. I haven't worked with GUI's for too long, but I am getting there. I have a problem. I have a combo box that has default writing in it telling people to click the dropdown and pick something. if they don't do that, and just hit the submit button, I need the script to give a message box, then restart the loop until they pick something different. here is part of my code, with a couple variables changed, but it is the same concept in my script:

if $msg = $button_3 Then

$t = GUICtrlRead($combo_2)

if $t = "whatever1" Then

$pc = "pc1"

ElseIf $t = "whatever2" Then

$pc = "pc2"

ElseIf $t = "whatever3" Then

$pc = "pc3"

ElseIf $t = "whatever4" Then

$pc = "pc4"

ElseIf $t = "whatever5" Then

$pc = "pc5"

ElseIf $t = "whatever6" Then

$pc = "pc6"

ElseIf $t = "whatever7" Then

$pc = "pc7"

ElseIf $t = "Please click dropdown arrow to select" Then

; i need it to restart the loop here. go back and let the user click the drop down again and keep doing it until they pick something else

EndIf

guidelete()

any ideas on how to do this? Thanks everybody!

byteme

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Local $AllDone=0, $msg
While Not $AllDone
    $msg=GUIGetMsg()
    if $msg = $button_3 Then
        $t = GUICtrlRead($combo_2)
        If $t = "Please click dropdown arrow to select" Then
            MsgBox(8192, 'Invalid Selection', 'Please select an option in the drop-down box')
        Else
            $AllDone = 1
        EndIf
    EndIf
WEnd
;continue program here
guidelete()

Edited by blindwig

Share this post


Link to post
Share on other sites

Thank you blindwig! That worked great! I was pulling my hair out trying to figure that out. I guess I have a lot more to learn about loops and gui's. Thanks for the help!

Byteme

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  
Followers 0