Jump to content

GuiCtrlCreateCheckbox and Input not working


Recommended Posts

Guest decibel

What i am doing wrong? i am trying to create GuiCtrlCreateCheckbox and GuiCtrlCreateInput depending of GUICtrlCreateInput variable. but it does not work. any idea? sorry for my english

#include <GuiConstants.au3>

GuiCreate("Tareas consecutivas", 400, 400)

GuiCtrlCreateLabel("Tareas", 30, 15)

$input = GUICtrlCreateInput ("1", 70, 15, 40, 20)

GuiCtrlCreateUpDown($input)

$i = 0

Do

$n = 45 + (30 * $i)

GuiCtrlCreateCheckbox("", 30, $n, 80, 20)

GuiCtrlCreateInput("Sample Input Box", 45, $n, 200, 20)

$i = $i + 1

Until $i = $input

GuiSetState()

While GuiGetMsg() <> $GUI_EVENT_CLOSE

WEnd

Link to post
Share on other sites

#include <GuiConstants.au3>

Global $input,$updown,$m_win,   $i = 0,$ctrlinput[1],$chkbox[1]

$m_win = GuiCreate("Tareas consecutivas", 400, 400)

GuiCtrlCreateLabel("Tareas", 30, 15)
$input = GUICtrlCreateInput ("1", 70, 15, 40, 20)
$updown = GuiCtrlCreateUpDown($input)
GUICtrlSetLimit($updown,5,0)

GuiSetState()

for $i = 0 to GUICtrlRead($input) - 1
        $n = 45 + (30 * $i)
        $chkbox[$i] = GuiCtrlCreateCheckbox("", 30, $n, 80, 20)
        $ctrlinput[$i] = GuiCtrlCreateInput("Sample Input Box", 45, $n, 200, 20)
Next
Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $updown Or $msg = $input
            for $i = 0 to UBound($chkbox) - 1
                GUICtrlDelete($chkbox[$i])
                GUICtrlDelete($ctrlinput[$i])
            Next
            ReDim $chkbox[GUICtrlRead($input)+1]
            ReDim $ctrlinput[GUICtrlRead($input)+1]
            for $i = 0 to GUICtrlRead($input) - 1
                $n = 45 + (30 * $i)
                $chkbox[$i] = GuiCtrlCreateCheckbox("", 30, $n, 80, 20)
                $ctrlinput[$i] = GuiCtrlCreateInput("Sample Input Box", 45, $n, 200, 20)
            Next
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

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.

 

Link to post
Share on other sites
Guest decibel

i'm having new problems, i'm trying to write from a file to $ctrlinput but i cannot make it work. what's wrong? thanks

#include <GuiConstants.au3>

Global $input,$updown,$m_win,   $i = 0,$ctrlinput[1],$chkbox[1]

$m_win = GuiCreate("Tareas consecutivas", 400, 400)

GuiCtrlCreateLabel("Tareas", 30, 15)
$input = GUICtrlCreateInput ("1", 70, 15, 40, 20)
$updown = GuiCtrlCreateUpDown($input)
GUICtrlSetLimit($updown,10,0)

$file = FileOpen("test.txt", 0)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    $n = 45 + (30 * $i)
    $chkbox[$i] = GuiCtrlCreateCheckbox("", 30, $n, 80, 20)
    $ctrlinput[$i] = GuiCtrlCreateInput($line, 45, $n, 200, 20)
    $i = $i + 1
    $updown = $i
Wend

FileClose($file)

GuiSetState()

Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $updown Or $msg = $input
            for $i = 0 to UBound($chkbox) - 1
                GUICtrlDelete($chkbox[$i])
                GUICtrlDelete($ctrlinput[$i])
            Next
            ReDim $chkbox[GUICtrlRead($input)+1]
            ReDim $ctrlinput[GUICtrlRead($input)+1]
            for $i = 1 to GUICtrlRead($input)
                $n = 30 + (30 * $i)
                $chkbox[$i] = GuiCtrlCreateCheckbox("", 30, $n, 80, 20)
                $ctrlinput[$i] = GuiCtrlCreateInput("Sample Input Box", 45, $n, 200, 20)
            Next
    EndSelect
Until $msg = $GUI_EVENT_CLOSE
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...