Sign in to follow this  
Followers 0
anybastard

Help me with this GUI

3 posts in this topic

Hi guys,

I need your help about my first " complex " GUI

I don't understand becouse " Run " button don't work with selected check box

Could you help me , please

Below my source code

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\as4935\desktop\mytool.kxf
Global $Checkbox [10]



$Form2 = GUICreate("My_Tool", 306, 255, 237, 195)
$Checkbox [0] = GUICtrlCreateCheckbox("Checkbox_0", 16, 32, 81, 17)
$Checkbox [1] = GUICtrlCreateCheckbox("Checkbox_1", 16, 56, 81, 17)
$Checkbox [2] = GUICtrlCreateCheckbox("Checkbox_2", 16, 112, 81, 17)
$Checkbox [3] = GUICtrlCreateCheckbox("Checkbox_3", 16, 136, 81, 17)
$Checkbox [4] = GUICtrlCreateCheckbox("Checkbox_4", 16, 184, 81, 17)
$Checkbox [5] = GUICtrlCreateCheckbox("Checkbox_5", 152, 32, 129, 17)
$Checkbox [6] = GUICtrlCreateCheckbox("Checkbox_6", 152, 64, 129, 17)
$Checkbox [7] = GUICtrlCreateCheckbox("Checkbox_7", 152, 96, 129, 17)
$Checkbox [8] = GUICtrlCreateCheckbox("Checkbox_8", 152, 128, 129, 17)
$Checkbox [9] = GUICtrlCreateCheckbox("Checkbox_9", 152, 160, 129, 17)
$Run = GUICtrlCreateButton("Run", 176, 208, 89, 25, $WS_GROUP)

$Group1 = GUICtrlCreateGroup("Group_1", 8, 8, 113, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Group_2", 144, 8, 153, 177)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Group_3", 8, 88, 113, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
 Case $Checkbox[0] to $Checkbox[9]
    if GUICtrlRead($nMsg) = $GUI_CHECKED Then
    for $n = 0 to 9
    if $Checkbox[$n] <> $nMsg Then
    GUICtrlSetState($Checkbox[$n],$GUI_DISABLE)
    EndIf
    Next
    Else
    for $n = 0 to 9
    if $Checkbox[$n] <> $nMsg Then
    GUICtrlSetState($Checkbox[$n],$GUI_ENABLE)
    EndIf
    Next
    EndIf
    

    EndSwitch
WEnd

Do
    $msg = GUIGetMsg()
    
    $status0 = GUICtrlRead ($Checkbox [0])
    $status1 = GUICtrlRead ($Checkbox [1])
    $status2 = GUICtrlRead ($Checkbox [2])
    $status3 = GUICtrlRead ($Checkbox [3])
    $status4 = GUICtrlRead ($Checkbox [4])
    $status5 = GUICtrlRead ($Checkbox [5])
    $status6 = GUICtrlRead ($Checkbox [6])
    $status7 = GUICtrlRead ($Checkbox [7])
    $status8 = GUICtrlRead ($Checkbox [8])
    $status9 = GUICtrlRead ($Checkbox [9])
    
Until $msg = $Run

IF $status0 = 1 then call ("App_0")
IF $status1 = 1 then call ("App_1")
IF $status2 = 1 then call ("App_2")
IF $status3 = 1 then call ("App_3")
IF $status4 = 1 then call ("App_4")
IF $status5 = 1 then call ("App_5")
IF $status6 = 1 then call ("App_6")
IF $status7 = 1 then call ("App_7")
IF $status8 = 1 then call ("App_8")
IF $status9 = 1 then call ("App_9")
    

    
Func App_0 ()
    MsgBox ( 0, "App_0" "You are running App_0" )
EndFunc

Func App_1 ()
    MsgBox (0 , "App_1" "You are running App_1" )
EndFunc

Func App_2 ()
    MsgBox (0 , "App_2" "You are running App_2" )
EndFunc

Func App_3 ()
    MsgBox (0 , "App_3" "You are running App_3" )
EndFunc

Func App_4 ()
    MsgBox (0 , "App_4" "You are running App_4" )
EndFunc

Func App_5 ()
    MsgBox (0 , "App_5" "You are running App_5" )
EndFunc

Func App_6 ()
    MsgBox (0 , "App_6" "You are running App_6" )
EndFunc

Func App_7 ()
    MsgBox (0 , "App_7" "You are running App_8" )
EndFunc

Func App_8 ()
    MsgBox (0 , "App_8" "You are running App_8" )
EndFunc

Func App_9 ()
    MsgBox (0 , "App_9" "You are running App_9" )
    EndFunc

Thank for your help

Regards

AnyB

Share this post


Link to post
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\as4935\desktop\mytool.kxf
Global $Checkbox[10]



$Form2 = GUICreate("My_Tool", 306, 255, 237, 195)
$Checkbox[0] = GUICtrlCreateCheckbox("Checkbox_0", 16, 32, 81, 17)
$Checkbox[1] = GUICtrlCreateCheckbox("Checkbox_1", 16, 56, 81, 17)
$Checkbox[2] = GUICtrlCreateCheckbox("Checkbox_2", 16, 112, 81, 17)
$Checkbox[3] = GUICtrlCreateCheckbox("Checkbox_3", 16, 136, 81, 17)
$Checkbox[4] = GUICtrlCreateCheckbox("Checkbox_4", 16, 184, 81, 17)
$Checkbox[5] = GUICtrlCreateCheckbox("Checkbox_5", 152, 32, 129, 17)
$Checkbox[6] = GUICtrlCreateCheckbox("Checkbox_6", 152, 64, 129, 17)
$Checkbox[7] = GUICtrlCreateCheckbox("Checkbox_7", 152, 96, 129, 17)
$Checkbox[8] = GUICtrlCreateCheckbox("Checkbox_8", 152, 128, 129, 17)
$Checkbox[9] = GUICtrlCreateCheckbox("Checkbox_9", 152, 160, 129, 17)
$Run = GUICtrlCreateButton("Run", 176, 208, 89, 25, $WS_GROUP)

$Group1 = GUICtrlCreateGroup("Group_1", 8, 8, 113, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Group_2", 144, 8, 153, 177)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Group_3", 8, 88, 113, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox[0] To $Checkbox[9]
            If GUICtrlRead($nMsg) = $GUI_CHECKED Then
                For $n = 0 To 9
                    If $Checkbox[$n] <> $nMsg Then
                        GUICtrlSetState($Checkbox[$n], $GUI_DISABLE)
                    EndIf
                Next
            Else
                For $n = 0 To 9
                    If $Checkbox[$n] <> $nMsg Then
                        GUICtrlSetState($Checkbox[$n], $GUI_ENABLE)
                    EndIf
                Next
            EndIf
        Case $Run
            $status0 = GUICtrlRead($Checkbox[0])
            $status1 = GUICtrlRead($Checkbox[1])
            $status2 = GUICtrlRead($Checkbox[2])
            $status3 = GUICtrlRead($Checkbox[3])
            $status4 = GUICtrlRead($Checkbox[4])
            $status5 = GUICtrlRead($Checkbox[5])
            $status6 = GUICtrlRead($Checkbox[6])
            $status7 = GUICtrlRead($Checkbox[7])
            $status8 = GUICtrlRead($Checkbox[8])
            $status9 = GUICtrlRead($Checkbox[9])

            If $status0 = 1 Then Call("App_0")
            If $status1 = 1 Then Call("App_1")
            If $status2 = 1 Then Call("App_2")
            If $status3 = 1 Then Call("App_3")
            If $status4 = 1 Then Call("App_4")
            If $status5 = 1 Then Call("App_5")
            If $status6 = 1 Then Call("App_6")
            If $status7 = 1 Then Call("App_7")
            If $status8 = 1 Then Call("App_8")
            If $status9 = 1 Then Call("App_9")
    EndSwitch
WEnd

Func App_0()
    MsgBox(0, "App_0", "You are running App_0")
EndFunc   ;==>App_0

Func App_1()
    MsgBox(0, "App_1", "You are running App_1")
EndFunc   ;==>App_1

Func App_2()
    MsgBox(0, "App_2", "You are running App_2")
EndFunc   ;==>App_2

Func App_3()
    MsgBox(0, "App_3", "You are running App_3")
EndFunc   ;==>App_3

Func App_4()
    MsgBox(0, "App_4", "You are running App_4")
EndFunc   ;==>App_4

Func App_5()
    MsgBox(0, "App_5", "You are running App_5")
EndFunc   ;==>App_5

Func App_6()
    MsgBox(0, "App_6", "You are running App_6")
EndFunc   ;==>App_6

Func App_7()
    MsgBox(0, "App_7", "You are running App_8")
EndFunc   ;==>App_7

Func App_8()
    MsgBox(0, "App_8", "You are running App_8")
EndFunc   ;==>App_8

Func App_9()
    MsgBox(0, "App_9", "You are running App_9")
EndFunc   ;==>App_9


AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites

Hi Slayerz ,

first for all ..thank for your help

Now all work fine !!!

Best Regards

AnyB

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