Jump to content
Sign in to follow this  
chinaboy

GUICtrlCreateInput problems

Recommended Posts

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=g:\au3test\victor2.kxf
$Form1_1_1 = GUICreate("AForm1", 663, 454, 193, 115)
$Label1 = GUICtrlCreateLabel("01", 16, 28, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("02", 16, 64, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("03", 16, 96, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("04", 16, 128, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("05", 16, 160, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("06", 16, 192, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("07", 16, 224, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("08", 16, 256, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("09", 16, 288, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("10", 16, 320, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("500", 72, 32, 57, 28)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 72, 64, 57, 28)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 72, 96, 57, 28)
$Input4 = GUICtrlCreateInput("", 72, 128, 57, 28)
$Input5 = GUICtrlCreateInput("", 72, 160, 57, 28)
$Input6 = GUICtrlCreateInput("", 72, 192, 57, 28)
$Input7 = GUICtrlCreateInput("", 72, 224, 57, 28)
$Input8 = GUICtrlCreateInput("", 72, 256, 57, 28)
$Input9 = GUICtrlCreateInput("", 72, 288, 57, 28)
$Input10 = GUICtrlCreateInput("", 72, 320, 57, 28)
$Label11 = GUICtrlCreateLabel("11", 139, 26, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("12", 139, 62, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label13 = GUICtrlCreateLabel("13", 139, 94, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label14 = GUICtrlCreateLabel("14", 139, 126, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("15", 139, 158, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label16 = GUICtrlCreateLabel("16", 139, 190, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label17 = GUICtrlCreateLabel("17", 139, 222, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label18 = GUICtrlCreateLabel("18", 139, 254, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label19 = GUICtrlCreateLabel("19", 139, 286, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label20 = GUICtrlCreateLabel("20", 139, 318, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input11 = GUICtrlCreateInput("", 195, 30, 57, 28)
$Input12 = GUICtrlCreateInput("", 195, 62, 57, 28)
$Input13 = GUICtrlCreateInput("", 195, 94, 57, 28)
$Input14 = GUICtrlCreateInput("", 195, 126, 57, 28)
$Input15 = GUICtrlCreateInput("", 195, 158, 57, 28)
$Input16 = GUICtrlCreateInput("", 195, 190, 57, 28)
$Input17 = GUICtrlCreateInput("", 195, 222, 57, 28)
$Input18 = GUICtrlCreateInput("", 195, 254, 57, 28)
$Input19 = GUICtrlCreateInput("", 195, 286, 57, 28)
$Input20 = GUICtrlCreateInput("", 195, 318, 57, 28)
$Label21 = GUICtrlCreateLabel("21", 266, 24, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label22 = GUICtrlCreateLabel("22", 266, 60, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label23 = GUICtrlCreateLabel("23", 266, 92, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label24 = GUICtrlCreateLabel("24", 266, 124, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label25 = GUICtrlCreateLabel("25", 266, 156, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label26 = GUICtrlCreateLabel("26", 266, 188, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label27 = GUICtrlCreateLabel("27", 266, 220, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label28 = GUICtrlCreateLabel("28", 266, 252, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label29 = GUICtrlCreateLabel("29", 266, 284, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label30 = GUICtrlCreateLabel("30", 266, 316, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input21 = GUICtrlCreateInput("", 322, 28, 57, 28)
$Input22 = GUICtrlCreateInput("", 322, 60, 57, 28)
$Input23 = GUICtrlCreateInput("", 322, 92, 57, 28)
$Input24 = GUICtrlCreateInput("", 322, 124, 57, 28)
$Input25 = GUICtrlCreateInput("", 322, 156, 57, 28)
$Input26 = GUICtrlCreateInput("", 322, 188, 57, 28)
$Input27 = GUICtrlCreateInput("", 322, 220, 57, 28)
$Input28 = GUICtrlCreateInput("", 322, 252, 57, 28)
$Input29 = GUICtrlCreateInput("", 322, 284, 57, 28)
$Input30 = GUICtrlCreateInput("", 322, 316, 57, 28)
$Label31 = GUICtrlCreateLabel("31", 400, 26, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label32 = GUICtrlCreateLabel("32", 400, 62, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label33 = GUICtrlCreateLabel("33", 400, 94, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label34 = GUICtrlCreateLabel("34", 400, 126, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label35 = GUICtrlCreateLabel("35", 400, 158, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label36 = GUICtrlCreateLabel("36", 400, 190, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label37 = GUICtrlCreateLabel("37", 400, 222, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label38 = GUICtrlCreateLabel("38", 400, 254, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label39 = GUICtrlCreateLabel("39", 400, 286, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label40 = GUICtrlCreateLabel("40", 400, 318, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input31 = GUICtrlCreateInput("", 456, 30, 57, 28)
$Input32 = GUICtrlCreateInput("", 456, 62, 57, 28)
$Input33 = GUICtrlCreateInput("", 456, 94, 57, 28)
$Input34 = GUICtrlCreateInput("", 456, 126, 57, 28)
$Input35 = GUICtrlCreateInput("", 456, 158, 57, 28)
$Input36 = GUICtrlCreateInput("", 456, 190, 57, 28)
$Input37 = GUICtrlCreateInput("", 456, 222, 57, 28)
$Input38 = GUICtrlCreateInput("", 456, 254, 57, 28)
$Input39 = GUICtrlCreateInput("", 456, 286, 57, 28)
$Input40 = GUICtrlCreateInput("", 456, 318, 57, 28)
$Label41 = GUICtrlCreateLabel("41", 529, 31, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label42 = GUICtrlCreateLabel("42", 529, 67, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label43 = GUICtrlCreateLabel("43", 529, 99, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label44 = GUICtrlCreateLabel("44", 529, 131, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label45 = GUICtrlCreateLabel("45", 529, 163, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label46 = GUICtrlCreateLabel("46", 529, 195, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label47 = GUICtrlCreateLabel("47", 529, 227, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label48 = GUICtrlCreateLabel("48", 529, 259, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label49 = GUICtrlCreateLabel("49", 529, 291, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Label50 = GUICtrlCreateLabel("50", 529, 323, 40, 28, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
$Input41 = GUICtrlCreateInput("", 585, 35, 57, 28)
$Input42 = GUICtrlCreateInput("", 585, 67, 57, 28)
$Input43 = GUICtrlCreateInput("", 585, 99, 57, 28)
$Input44 = GUICtrlCreateInput("", 585, 131, 57, 28)
$Input45 = GUICtrlCreateInput("", 585, 163, 57, 28)
$Input46 = GUICtrlCreateInput("", 585, 195, 57, 28)
$Input47 = GUICtrlCreateInput("", 585, 227, 57, 28)
$Input48 = GUICtrlCreateInput("", 585, 259, 57, 28)
$Input49 = GUICtrlCreateInput("", 585, 291, 57, 28)
$Input50 = GUICtrlCreateInput("", 585, 323, 57, 28)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

How to make the number in the inputbox from 1 to 1000 and just accept numeric and when I press "Enter" the next inputbox will get the focus. thanks?

:) Thank you for your help! DjDeep00.

Edited by chinaboy

Share this post


Link to post
Share on other sites

@chinaboy...Couple of things I would do...

1. Use GUISetFont() for all of the controls in the gui instead of using for each control.

2. Use Loops to create the input and label controls. For example...

Dim $Label[11]
$y=5

For $x=1 to 10
$y=$y+35
$Label[$x] = GUICtrlCreateLabel($x, 16, $y, 40, 28, $SS_CENTER)
Next

3. Use $ES_NUMBER for only allowing numbers to be entered in the input fields.

4. Use Guictrlsetlimit to set max or min length.

5. Use Hotkeyset for moving onto other input fields...for example

HotKeySet("{ENTER}","Jump")

Some where at the end of your code make the following function...

Func Jump ()
Send("{TAB}")
EndFunc

I am sure there are other better ways of doing all of this but to get you started this should be enough.

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  

×
×
  • Create New...