W00tever Posted June 2, 2009 Posted June 2, 2009 Hi there, I've searched and searched and can't find exactly what I'm looking for. I have a simple gui, a text box (GuiCtrlCreateEdit) one item per line and a submit button. Can anyone point me to the right syntax to execute the same function on submit for each line in the text box? Thanks in advance, Dan
W00tever Posted June 2, 2009 Author Posted June 2, 2009 show your code, it is easier to help you8)GuiCreate("mygui", 350, 380)GuiSetIcon(@SystemDir & "\mspaint.exe", 0)$list = GuiCtrlCreateEdit("", 50, 50, 250, 170)$check = GuiCtrlCreateCheckbox("Manual (default template is used unless this is checked)", 10, 275, 300, 50)Opt("GUIOnEventMode", 1)$submitbutton = GuiCtrlCreateButton("Submit and install", 200, 330, 100, 30)GUICtrlSetOnEvent($submitbutton, "OK")GUISetOnEvent($GUI_EVENT_CLOSE, "CancelPressed")GUISetState(@SW_SHOW)Func CancelPressed() ExitEndFunc ;==>CancelPressedWhile 1 Sleep(1000)WEndFunc OK() ;main function goes here
Valuater Posted June 2, 2009 Posted June 2, 2009 I was gone for a while and thought someone else would step-up This is what I think you want to do.... #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) GUICreate("mygui", 350, 380) GUISetIcon(@SystemDir & "\mspaint.exe", 0) $list = GUICtrlCreateEdit("", 50, 50, 250, 170) $check = GUICtrlCreateCheckbox("Manual (default template is used unless this is checked)", 10, 275, 300, 50) $submitbutton = GUICtrlCreateButton("Submit and install", 200, 330, 100, 30) GUICtrlSetOnEvent($submitbutton, "OK") GUISetOnEvent($GUI_EVENT_CLOSE, "CancelPressed") GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd ;---------Functions ----------------- Func OK() $info = GUICtrlRead($list) $split = StringSplit(StringStripCR($info), @LF) For $x = 1 To $split[0] MsgBox(4096, "", $split[$x], 4) Next EndFunc ;==>OK Func CancelPressed() Exit EndFunc ;==>CancelPressed 8)
W00tever Posted June 3, 2009 Author Posted June 3, 2009 I was gone for a while and thought someone else would step-up This is what I think you want to do.... #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) GUICreate("mygui", 350, 380) GUISetIcon(@SystemDir & "\mspaint.exe", 0) $list = GUICtrlCreateEdit("", 50, 50, 250, 170) $check = GUICtrlCreateCheckbox("Manual (default template is used unless this is checked)", 10, 275, 300, 50) $submitbutton = GUICtrlCreateButton("Submit and install", 200, 330, 100, 30) GUICtrlSetOnEvent($submitbutton, "OK") GUISetOnEvent($GUI_EVENT_CLOSE, "CancelPressed") GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd ;---------Functions ----------------- Func OK() $info = GUICtrlRead($list) $split = StringSplit(StringStripCR($info), @LF) For $x = 1 To $split[0] MsgBox(4096, "", $split[$x], 4) Next EndFunc ;==>OK Func CancelPressed() Exit EndFunc ;==>CancelPressed 8) Thanks alot, that's a good start. Slight problem, it's pulling a form for each however it's appending all entries on the same line. In the box I put 1 2 3 4 5 6 When I execute it's pulling up 6 copies of the form but putting 123456 in the name field where it should put 1 in one form 2 in the next... Any ideas?
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