brodie28 Posted July 11, 2008 Share Posted July 11, 2008 (edited) Func qcode() msgbox(0, "test", "starting qcode") _IEAction ( $o_IE, "visible" ) $Form3 = GUICreate("Enter Security Code", 219, 68, 193, 125) $secinput = GUICtrlCreateInput("", 16, 22, 113, 21) $subsec = GUICtrlCreateButton("Submit", 144, 20, 65, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "terminate") GUICtrlSetOnEvent ( $subsec, "SubmitCode" ) while 1 sleep(50) WEnd EndFunc Anyone have any idea why when this function is called, the GUI it creates does nothing? It is the only GUI open at the time it is called... Also, Opt("GUIOnEventMode", 1) is used earlier in the script. Edited July 11, 2008 by brodie28 Link to comment Share on other sites More sharing options...
Andreik Posted July 11, 2008 Share Posted July 11, 2008 #include <GuiConstants.au3> AutoItSetOption ( "GUIOnEventMode",1) $Form3 = GUICreate("Enter Security Code", 219, 68, 193, 125) $secinput = GUICtrlCreateInput("", 16, 22, 113, 21) $subsec = GUICtrlCreateButton("Submit", 144, 20, 65, 25, 0) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "terminate") GUICtrlSetOnEvent ( $subsec, "SubmitCode" ) while 1 sleep(50) WEnd Func terminate() Exit EndFunc Func SubmitCode() MsgBox(0,"","SUBMIT") EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 11, 2008 Developers Share Posted July 11, 2008 Is this func called by an EVENT from another GUI? If so you need to complete that event first before a next Event is handled. 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 More sharing options...
wraithdu Posted July 11, 2008 Share Posted July 11, 2008 As in the script posted above, it's not a good idea to have a while loop in your function. You main while loop should be in the main body of the script. In addition if this is a second GUI, you don't need another while loop, as the first / main loop takes care of this. Link to comment Share on other sites More sharing options...
brodie28 Posted July 11, 2008 Author Share Posted July 11, 2008 I need to have a while loop in that function though. In my script, There is a main GUI at the start which has a while loop... But then it calls a function and the main GUI is deleted. In the middle of the function it calls, this function is called and I need it to stop and get the user input before the first function continues. It looks something like this: Main GUI (with while loop) - calls function main() main() - In the middle of this function, the function I posted is called. So it needs its own while loop so that the user inputs the data needed before continuing the main function. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 12, 2008 Developers Share Posted July 12, 2008 I need to have a while loop in that function though. In my script, There is a main GUI at the start which has a while loop... But then it calls a function and the main GUI is deleted. In the middle of the function it calls, this function is called and I need it to stop and get the user input before the first function continues.It looks something like this:Main GUI (with while loop) - calls function main()main() - In the middle of this function, the function I posted is called.So it needs its own while loop so that the user inputs the data needed before continuing the main function.I have given you the reason why it doesn't work when the Func qcode() is called by a EVENT. You need to change your code that this Event finishes before building the new GUI or not use GUIEvents for the second GUI.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 More sharing options...
wraithdu Posted July 12, 2008 Share Posted July 12, 2008 I need to have a while loop in that function though. In my script, There is a main GUI at the start which has a while loop... But then it calls a function and the main GUI is deleted. In the middle of the function it calls, this function is called and I need it to stop and get the user input before the first function continues.It just will not work that way. You can only have one While loop for OnEvent mode. You'll have to break the first function up. If you need data from this first GUI to create the main GUI, then do you initialization and call this GUI in one function. In the exit function for this GUI call the function that creates your main GUI - Init() -> call _InputGUI()InputGUI exit function -> calls _MainGUI() 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