silvano Posted August 8, 2007 Share Posted August 8, 2007 hi, can i create the form with dynamic guicreatelabel and button? i have write this script but i don't know as to read the field with GUICtrlRead($input[$i]) after to have pressed the relative button #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 535, 233, 238, 196) Dim $input[200] Dim $button[200] $top = 25 $i = 1 While $i <= 5 $input[$i] = GUICtrlCreateInput("ALabel "&$i, 24, $top, 100, 20) $button[$i] = GUICtrlCreateButton("geenra "&$i,200,$top,100,20) $i = $i + 1 $top = $top + 30 WEnd GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ; don't work ;Case ;$button[$i] ;MsgBox(0,"",GUICtrlRead($label[$i])) EndSwitch WEnd thank you Link to comment Share on other sites More sharing options...
Valuater Posted August 8, 2007 Share Posted August 8, 2007 Maybe... #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 535, 233, 238, 196) Dim $input[200] Dim $button[200] $top = 25 $i = 1 $Button_count = 5 For $i = 1 to $Button_count $input[$i] = GUICtrlCreateInput("ALabel "&$i, 24, $top, 100, 20) $button[$i] = GUICtrlCreateButton("geenra "&$i,200,$top,100,20) $top = $top + 30 Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE then Exit for $x = 1 to $Button_count If $nMsg = $button[$x] Then MsgBox(0x0, "Input #" & $x, GUICtrlRead($input[$x])) ExitLoop EndIf Next WEnd 8) Link to comment Share on other sites More sharing options...
DW1 Posted August 8, 2007 Share Posted August 8, 2007 (edited) This works for me: #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 535, 233, 238, 196) Dim $input[200] Dim $button[200] $top = 25 $amount = 6 ; this is how many buttons you made For $i = 1 to $amount $input[$i] = GUICtrlCreateInput("ALabel " & $i, 24, $top, 100, 20) $button[$i] = GUICtrlCreateButton("geenra " & $i, 200, $top, 100, 20) $top = $top + 30 Next GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case Else For $i = 1 To $amount If $msg = $button[$i] Then MsgBox(0, "", GUICtrlRead($input[$i])) Next EndSelect WEnd Is that what you were looking for? EDIT: Damn Valuater, that must have been posted at EXACTLY the same time LOL, I just did a refresh before I submitted. Aarrrggg!!! Edited August 8, 2007 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
silvano Posted August 8, 2007 Author Share Posted August 8, 2007 EDIT: Damn Valuater, that must have been posted at EXACTLY the same time LOL, I just did a refresh before I submitted. Aarrrggg!!!and now I which use? :-D thank you! 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