Jump to content

GUICtrlCreateLabel


Recommended Posts

i want $Label1 = GUICtrlCreateLabel("3", 33, 72, 10, 17) , so when check it will send

controlsend("$a", "", "", "3")

(i have the 4a working)

i think i will need to put the $Label1 somewhere but i dont know where

maybe a If $Label Do Controlsend..... etc

any help plz :)

Link to comment
Share on other sites

oops sorry yes, i copied wrong bit of my script, is checkbox i mean,

GUICtrlCreateCheckbox("", 49, 72, 14, 17)

when thats checked send controlsend.........

Okay. Do you want an action to take place the instant the checbox is checked, or is there a button to execute? It sounds like it may be better to have a button if you need a click action.

Link to comment
Share on other sites

i have 8 checkboxes sending diff numbers, but sometimes i dont want all 8, so i want it in a GUI(which i have) where i can chooses, theres 8 checkboxes, and a start button, i wanna check the boxes( according to numbers) i wanna use, then press start and it will send them

Link to comment
Share on other sites

This might be more complex than you are wanting but it does what you need.

#include <GUIConstants.au3>

GUICreate("My GUI", 400, 250)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box

Dim $checkArray[8]

;Create 8 checkboxes
For $X = 0 to Ubound($checkArray) - 1
    $checkArray[$X] = GUICtrlCreateCheckbox($X+1, 10,10 + (20 *$X), 40, 20)
Next

$startButton = GUICtrlCreateButton("Start", 170, 200, 60)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $startButton
            $output = ""
            
            For $X = 0 to Ubound($checkArray) - 1
                If BitAnd(GuiCtrlRead($checkArray[$X]), $GUI_CHECKED) Then
                    $output &= $X + 1
                EndIf
            Next
            
            MsgBox(0,"",$output)
            ;ControlSend("","","",$output)
    EndSwitch
Wend
Link to comment
Share on other sites

hmm im confussed :)

$Label1 = GUICtrlCreateLabel("3", 33, 72, 10, 17)

$Label2 = GUICtrlCreateLabel("5", 33, 120, 10, 17)

$Label4 = GUICtrlCreateLabel("6", 33, 144, 10, 17)

$Label5 = GUICtrlCreateLabel("7", 33, 168, 10, 17)

$Label6 = GUICtrlCreateLabel("4", 33, 96, 10, 17)

$Label7 = GUICtrlCreateLabel("8", 97, 72, 10, 17)

$Label8 = GUICtrlCreateLabel("9", 97, 96, 10, 17)

$Label9 = GUICtrlCreateLabel("0", 97, 120, 10, 17)

$Label10 = GUICtrlCreateLabel("-", 97, 144, 7, 17)

$Label11 = GUICtrlCreateLabel("=", 97, 168, 10, 17)

$check1 = GUICtrlCreateCheckbox("", 49, 72, 14, 17)

GUICtrlCreateCheckbox("", 49, 96, 14, 17)

GUICtrlCreateCheckbox("", 49, 120, 14, 17)

GUICtrlCreateCheckbox("", 49, 144, 14, 17)

GUICtrlCreateCheckbox("Checkbox4", 121, 96, 14, 17)

GUICtrlCreateCheckbox("Checkbox4", 121, 120, 14, 17)

GUICtrlCreateCheckbox("Checkbox4", 121, 72, 14, 17)

GUICtrlCreateCheckbox("Checkbox4", 49, 168, 14, 17)

GUICtrlCreateCheckbox("Checkbox4", 121, 168, 14, 17)

GUICtrlCreateCheckbox("Checkbox4", 121, 144, 14, 17)

$Label1 matches to first guicheckbox etc,

i want to do something like

$Label1 = GUICtrlCreateLabel("3", 33, 72, 10, 17)

when checked send

controlsend("$a", "", "", "3")

$Label2 etc.....

but i dont know what to write it correctly, or if it can be done

Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate("My GUI", 400, 250)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box

;Split possible values into array
Dim $checkValues = StringSplit("35674890-=","")

;Create second array which will contain checkbox handles + values
Dim $checkArray[$checkValues[0]][2]

;Create 8 checkboxes
For $X = 0 to Ubound($checkArray) - 1
    $checkArray[$X][0] = GUICtrlCreateCheckbox($checkValues[$X+1], 10,10 + (20 *$X), 40, 20)
    $checkArray[$X][1] = $checkValues[$X+1]
Next

$startButton = GUICtrlCreateButton("Start", 170, 200, 60)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $startButton
            $output = ""
           
            For $X = 0 to Ubound($checkArray) - 1
                If BitAnd(GuiCtrlRead($checkArray[$X][0]), $GUI_CHECKED) Then
                    $output &= $checkArray[$X][1]
                EndIf
            Next
           
            MsgBox(0,"",$output)
            ;ControlSend("","","",$output)
    EndSwitch
Wend

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...