Razi Posted January 29, 2023 Share Posted January 29, 2023 I have 3 questions. 1) How to create 100 Input boxes with code? #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 624, 443, 192, 124) For $y = 0 To 4 For $a = 0 To 9 GUICtrlCreateInput('Input' & $a+1 + $y*10, 12+$y*80, 32+$a*32 , 55, 21) Next Next ;GUICtrlSetData($Input2,"Input222") - can't set other text in the $Input2 GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd But, I can't change text in the $Input2 or other Input boxes 2) How to change text in the 1 or 10 Input boxes with "For"? The following code doesn't work: GUICtrlSetData($Input2,"Input222") 3) When above code is pasted in Koda (Form Designer via File->Import->Import Autoit GUI) it doesn't work. How can I make the code above work in the Form designer in order to save, Form with Controls, in Form designer? Autoit v3.3.14.5; SciTE v.4.4.6. First time using Autoit. Link to comment Share on other sites More sharing options...
Nine Posted January 29, 2023 Share Posted January 29, 2023 (edited) Here : #include <GUIConstants.au3> Local $hGUI = GUICreate("Form1", 624, 443, 192, 124) Local $aInput[50], $c = 0, $nMsg For $y = 0 To 4 For $a = 0 To 9 $aInput[$c] = GUICtrlCreateInput('Input' & $a + 1 + $y * 10, 12 + $y * 80, 32 + $a * 32, 55, 21) $c += 1 Next Next GUICtrlSetData($aInput[2], "Input222") GUISetState() While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $aInput[0] To $aInput[UBound($aInput) - 1] ConsoleWrite("Input " & $nMsg - $aInput[0] & " has been modified" & @CRLF) EndSwitch WEnd ps. Forget using Koda for that kind of design. Edited January 29, 2023 by Nine Razi 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Razi Posted January 29, 2023 Author Share Posted January 29, 2023 2 hours ago, Nine said: Here : ps. Forget using Koda for that kind of design. Thanks. Now the script is working. Still in Koda (Form Designer via File->Import->Import Autoit GUI) the above script creates only 1 Input box. Link to comment Share on other sites More sharing options...
Dan_555 Posted January 29, 2023 Share Posted January 29, 2023 (edited) Well, you know, there is a way to do it, but ... see for your self: This is a converter script ( @Nine's example): #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 531, 369, 192, 124) Global $Edit1 = GUICtrlCreateEdit("", 1, 0, 527, 367) GUICtrlSetData(-1, "Edit1") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $aInput[50], $c = 0 For $y = 0 To 4 For $a = 0 To 9 memowrite("$aInput[" & $c & "] = GUICtrlCreateInput('Input' & " & $c & "," & (12 + $y * 80) & "," & (32 + $a * 32) &", 55, 21)") $c += 1 Next Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func memowrite($txt) GUICtrlSetData($Edit1, $txt & @CRLF, 1) EndFunc ;==>memowrite When you run it, it will create all the input boxes definitions. Then you have to copy the text into the original script and replace the following lines For $y = 0 To 4 For $a = 0 To 9 $aInput[$c] = GUICtrlCreateInput('Input' & $a + 1 + $y * 10, 12 + $y * 80, 32 + $a * 32, 55, 21) $c += 1 Next Next with it. Then it is parseable in the koda form designer. Edited January 29, 2023 by Dan_555 Razi 1 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Razi Posted January 29, 2023 Author Share Posted January 29, 2023 (edited) On 1/29/2023 at 12:38 PM, Dan_555 said: Well, you know, there is a way to do it, but ... see for your self: Thanks for the help. That helped. Edited January 30, 2023 by Razi Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now