Jump to content

How to assign value to a "dinamic" Input box


 Share

Recommended Posts

Hi all,

given this function:

func _createInput()
    $Alto  = 150
    $Sinistra = 176
    $delta = 0
    $multiplier = 0
    global $a,$s,$t
    for $t = 1 to 20
        for $a = 1 to 14 Step 1
            Assign("s",$t & "_" & $a)
            assign($s,GUICtrlCreateInput("",$Sinistra   +$delta*$multiplier,    $Alto,50,21,$ES_READONLY))
            $delta = 55
            $multiplier = $multiplier+1
        Next
        $alto = $alto +25
        $delta = 0
        $multiplier = 0
    Next
EndFunc

_createInput()

It creates me in the form all the input boxes i need.

How can i now GUICTRLSETDATA to every input?

if the correct expression is guictrlsetdata(IDcontrol,data) where do I get the exact control id?

Thanks,

Marco

Link to comment
Share on other sites

  • Developers

Avoid using Assign and simply use an Array to hold the Inputcontrol handles which then makes it simple to read them or write to them.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Can you please make me an example? I'm a bit tard about it.

Thanks a lot, mate.

Marco

this code is filling the array... just use similar logic with the other GUI functions:

Dim $INputHND[21][15]

Func _createInput()
    $Alto = 150
    $Sinistra = 176
    $delta = 0
    $multiplier = 0
    Global $a, $s, $t
    For $t = 1 To 20
        For $a = 1 To 14
            $INputHND[$t][$a] = GUICtrlCreateInput("", $Sinistra + $delta * $multiplier, $Alto, 50, 21, $ES_READONLY)
            $delta = 55
            $multiplier = $multiplier + 1
        Next
        $Alto = $Alto + 25
        $delta = 0
        $multiplier = 0
    Next
EndFunc   ;==>_createInput

_createInput()
Edited by Jos
fixed code

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Func _createInput()
    $Alto = 150
    $Sinistra = 176
    $delta = 0
    $multiplier = 0
    Global $a, $s, $t
    For $t = 1 To 20
        For $a = 1 To 14
            $INputHND[$t][$a] = GUICtrlCreateInput("", $Sinistra + $delta * $multiplier, $Alto, 50, 21, $ES_READONLY)
            $delta = 55
            $multiplier = $multiplier + 1
        Next
        $Alto = $Alto + 25
        $delta = 0
        $multiplier = 0
    Next
EndFunc   ;==>_createInput

_createInput()

This is the correct one, you missed a [$a]

Thanks a lot, mate!

Link to comment
Share on other sites

  • Developers

@Jos - Nice example. That should be put in the Wiki cookbook.

I have used a "simpler" example in SciTEConfig.au3 in the Tab where you can set the Color settings. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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