Sign in to follow this  
Followers 0
Schlumpf

variables

5 posts in this topic

Hi,

I'm building a GUI with a lot of "edit"-fields. The "edit"-fields have the IDs Input_1, Input_2, ... If a variable has the value e.g. 20, all "edit"-fields with an ID more than 20 should be inactive. But I've no idea...

Hope you anderstand what i mean... :whistle:


[CENTER]Sorry for my bad English... ;)[/CENTER]

Share this post


Link to post
Share on other sites



If you post your script...

...Then we can help you

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

OK:

#include <GuiConstants.au3>

GuiCreate("festlegen", 350, 490,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_44 = GuiCtrlCreateInput("2", 50, 15, 20, 20)

$Input_1 = GuiCtrlCreateInput("edit1", 20, 70, 140, 20)
$Input_2 = GuiCtrlCreateInput("edit2", 20, 110, 140, 20)
$Input_3 = GuiCtrlCreateInput("edit3", 20, 90, 140, 20)
$Input_4 = GuiCtrlCreateInput("edit4", 20, 130, 140, 20)
$Input_5 = GuiCtrlCreateInput("edit5", 20, 150, 140, 20)
$Input_6 = GuiCtrlCreateInput("edit6", 20, 170, 140, 20)
$Input_7 = GuiCtrlCreateInput("edit7", 20, 190, 140, 20)
$Input_8 = GuiCtrlCreateInput("edit8", 20, 210, 140, 20)
$Input_9 = GuiCtrlCreateInput("edit9", 20, 230, 140, 20)
$Input_10 = GuiCtrlCreateInput("edit10", 20, 250, 140, 20)
$Input_11 = GuiCtrlCreateInput("edit11", 20, 270, 140, 20)
$Input_12 = GuiCtrlCreateInput("edit12", 20, 290, 140, 20)
$Input_13 = GuiCtrlCreateInput("edit13", 20, 310, 140, 20)
$Input_14 = GuiCtrlCreateInput("edit14", 20, 330, 140, 20)
$Input_15 = GuiCtrlCreateInput("edit15", 20, 350, 140, 20)
$Input_16 = GuiCtrlCreateInput("edit16", 20, 370, 140, 20)
$Input_17 = GuiCtrlCreateInput("edit17", 20, 390, 140, 20)
$Input_18 = GuiCtrlCreateInput("edit18", 20, 410, 140, 20)
$Input_19 = GuiCtrlCreateInput("edit19", 20, 430, 140, 20)
$Input_20 = GuiCtrlCreateInput("edit20", 20, 450, 140, 20)

$Input_21 = GuiCtrlCreateInput("Name1", 190, 70, 140, 20)
$Input_22 = GuiCtrlCreateInput("Name2", 190, 90, 140, 20)
$Input_23 = GuiCtrlCreateInput("Name3", 190, 110, 140, 20)
$Input_24 = GuiCtrlCreateInput("Name4", 190, 130, 140, 20)
$Input_25 = GuiCtrlCreateInput("Name5", 190, 150, 140, 20)
$Input_26 = GuiCtrlCreateInput("Name6", 190, 170, 140, 20)
$Input_27 = GuiCtrlCreateInput("Name7", 190, 190, 140, 20)
$Input_28 = GuiCtrlCreateInput("Name8", 190, 210, 140, 20)
$Input_29 = GuiCtrlCreateInput("Name9", 190, 230, 140, 20)
$Input_30 = GuiCtrlCreateInput("Name10", 190, 250, 140, 20)
$Input_31 = GuiCtrlCreateInput("Name11", 190, 270, 140, 20)
$Input_32 = GuiCtrlCreateInput("Name12", 190, 290, 140, 20)
$Input_33 = GuiCtrlCreateInput("Name13", 190, 310, 140, 20)
$Input_34 = GuiCtrlCreateInput("Name14", 190, 330, 140, 20)
$Input_35 = GuiCtrlCreateInput("Name15", 190, 350, 140, 20)
$Input_36 = GuiCtrlCreateInput("Name16", 190, 370, 140, 20)
$Input_37 = GuiCtrlCreateInput("Name17", 190, 390, 140, 20)
$Input_38 = GuiCtrlCreateInput("Name18", 190, 410, 140, 20)
$Input_39 = GuiCtrlCreateInput("Name19", 190, 430, 140, 20)
$Input_40 = GuiCtrlCreateInput("Name20", 190, 450, 140, 20)
$Group_41 = GuiCtrlCreateGroup("EDITs", 10, 50, 160, 430)
$Group_42 = GuiCtrlCreateGroup("Namen", 180, 50, 160, 430)
$Icon_43 = GuiCtrlCreateIcon("icon.ico", 0, 10, 10, 32, 32)
$Label_45 = GuiCtrlCreateLabel("Anzahl der EDITs (max. 20)", 80, 20, 120, 20)
$Button_46 = GuiCtrlCreateButton("OK", 210, 10, 60, 30)
$Button_47 = GuiCtrlCreateButton("Abbrechen", 280, 10, 60, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_47
            Exit
    EndSelect
WEnd
Exit

[CENTER]Sorry for my bad English... ;)[/CENTER]

Share this post


Link to post
Share on other sites

maybe...

#include <GuiConstants.au3>

Dim $Input_[41] ; creates an array

GUICreate("festlegen", 350, 490, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input = GUICtrlCreateInput("2", 35, 17, 20, 20)

$Input_[1] = GUICtrlCreateInput("edit1", 20, 70, 140, 20)
$Input_[2] = GUICtrlCreateInput("edit2", 20, 110, 140, 20)
$Input_[3] = GUICtrlCreateInput("edit3", 20, 90, 140, 20)
$Input_[4] = GUICtrlCreateInput("edit4", 20, 130, 140, 20)
$Input_[5] = GUICtrlCreateInput("edit5", 20, 150, 140, 20)
$Input_[6] = GUICtrlCreateInput("edit6", 20, 170, 140, 20)
$Input_[7] = GUICtrlCreateInput("edit7", 20, 190, 140, 20)
$Input_[8] = GUICtrlCreateInput("edit8", 20, 210, 140, 20)
$Input_[9] = GUICtrlCreateInput("edit9", 20, 230, 140, 20)
$Input_[10] = GUICtrlCreateInput("edit10", 20, 250, 140, 20)
$Input_[11] = GUICtrlCreateInput("edit11", 20, 270, 140, 20)
$Input_[12] = GUICtrlCreateInput("edit12", 20, 290, 140, 20)
$Input_[13] = GUICtrlCreateInput("edit13", 20, 310, 140, 20)
$Input_[14] = GUICtrlCreateInput("edit14", 20, 330, 140, 20)
$Input_[15] = GUICtrlCreateInput("edit15", 20, 350, 140, 20)
$Input_[16] = GUICtrlCreateInput("edit16", 20, 370, 140, 20)
$Input_[17] = GUICtrlCreateInput("edit17", 20, 390, 140, 20)
$Input_[18] = GUICtrlCreateInput("edit18", 20, 410, 140, 20)
$Input_[19] = GUICtrlCreateInput("edit19", 20, 430, 140, 20)
$Input_[20] = GUICtrlCreateInput("20", 20, 450, 140, 20)

$Input_[21] = GUICtrlCreateInput("Name1", 190, 70, 140, 20)
$Input_[22] = GUICtrlCreateInput("Name2", 190, 90, 140, 20)
$Input_[23] = GUICtrlCreateInput("Name3", 190, 110, 140, 20)
$Input_[24] = GUICtrlCreateInput("Name4", 190, 130, 140, 20)
$Input_[25] = GUICtrlCreateInput("Name5", 190, 150, 140, 20)
$Input_[26] = GUICtrlCreateInput("Name6", 190, 170, 140, 20)
$Input_[27] = GUICtrlCreateInput("Name7", 190, 190, 140, 20)
$Input_[28] = GUICtrlCreateInput("Name8", 190, 210, 140, 20)
$Input_[29] = GUICtrlCreateInput("Name9", 190, 230, 140, 20)
$Input_[30] = GUICtrlCreateInput("Name10", 190, 250, 140, 20)
$Input_[31] = GUICtrlCreateInput("Name11", 190, 270, 140, 20)
$Input_[32] = GUICtrlCreateInput("Name12", 190, 290, 140, 20)
$Input_[33] = GUICtrlCreateInput("Name13", 190, 310, 140, 20)
$Input_[34] = GUICtrlCreateInput("Name14", 190, 330, 140, 20)
$Input_[35] = GUICtrlCreateInput("Name15", 190, 350, 140, 20)
$Input_[36] = GUICtrlCreateInput("Name16", 190, 370, 140, 20)
$Input_[37] = GUICtrlCreateInput("Name17", 190, 390, 140, 20)
$Input_[38] = GUICtrlCreateInput("Name18", 190, 410, 140, 20)
$Input_[39] = GUICtrlCreateInput("Name19", 190, 430, 140, 20)
$Input_[40] = GUICtrlCreateInput("20", 190, 450, 140, 20)
$Group_41 = GUICtrlCreateGroup("EDITs", 10, 50, 160, 430)
$Group_42 = GUICtrlCreateGroup("Namen", 180, 50, 160, 430)
$Icon_43 = GUICtrlCreateIcon("icon.ico", 0, 10, 10, 32, 32)
$Label_44 = GUICtrlCreateLabel("Anzahl der EDITs (max. 20)", 60, 20, 140, 20)
$Button_45 = GUICtrlCreateButton("OK", 210, 10, 60, 30)
$Button_46 = GUICtrlCreateButton("Abbrechen", 280, 10, 60, 30)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_46
            Exit
        Case $msg = $Button_45
            $Check_input = GUICtrlRead($Input)
            If $Check_input >= 20 Then
                For $X = 1 To 40
                    If GUICtrlRead($Input_[$X]) >= 20 Then 
                        GUICtrlSetState($Input_[$x], $GUI_DISABLE)
                    Else
                        GUICtrlSetState($Input_[$x], $GUI_ENABLE)
                    EndIf
                Next
            EndIf
    EndSelect

WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

wouldn't hurt to shorten it up a bit

#include <GuiConstants.au3>

Dim $Input_[41] ; creates an array

GUICreate("festlegen", 350, 490, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input = GUICtrlCreateInput("2", 40, 17, 20, 20)
$y = 70
For $x = 1 To 20 Step 2
    $Input_[$x] = GUICtrlCreateInput("edit" & $x, 20, $y, 140, 20)
    $Input_[$x + 1] = GUICtrlCreateInput("edit" & $x + 1, 20, $y + 20, 140, 20)
    $y = $y + 40
Next
GUICtrlSetData($Input_[20], "20")

$y = 70
For $x = 21 To 40 Step 2
    $Input_[$x] = GUICtrlCreateInput("Name" & $x, 190, $y, 140, 20)
    $Input_[$x + 1] = GUICtrlCreateInput("Name" & $x + 1, 190, $y + 20, 140, 20)
    $y = $y + 40
Next
GUICtrlSetData($Input_[40], "20")

$Group_41 = GUICtrlCreateGroup("EDITs", 10, 50, 160, 430)
$Group_42 = GUICtrlCreateGroup("Namen", 180, 50, 160, 430)
$Icon_43 = GUICtrlCreateIcon("icon.ico", 0, 10, 10, 32, 32)
$Label_44 = GUICtrlCreateLabel("Anzahl der EDITs (max. 20)", 65, 20, 140, 20)
$Button_45 = GUICtrlCreateButton("OK", 210, 10, 60, 30)
$Button_46 = GUICtrlCreateButton("Abbrechen", 280, 10, 60, 30)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_46
            Exit
        Case $msg = $Button_45
            $Check_input = GUICtrlRead($Input)
            If $Check_input >= 20 Then
                For $x = 1 To 40
                    If GUICtrlRead($Input_[$x]) >= 20 Then
                        GUICtrlSetState($Input_[$x], $GUI_DISABLE)
                    Else
                        GUICtrlSetState($Input_[$x], $GUI_ENABLE)
                    EndIf
                Next
            EndIf
    EndSelect
    
WEnd
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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