Bot Posted June 20, 2008 Posted June 20, 2008 I'm in a For loop and I want to check for user inputs and click the button before doing everything. Can anyone tell me how to do so please ? $Submit = GUICtrlCreateButton("Submit", 90, 100, 113, 25, 0) For $i = 5 to 1 Step -1 $sName = GUICtrlRead ($Name) If $sName <> "" Then #cs If user click the submit button then continue the program or wait until the user click the button. #ce EndIf #cs Do something #ce Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
LongBowNZ Posted June 20, 2008 Posted June 20, 2008 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Submit ; Do stuff after button is clicked EndSwitch WEnd
Bot Posted June 21, 2008 Author Posted June 21, 2008 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Submit ; Do stuff after button is clicked EndSwitch WEnd Thanks but your code is to let the button do some actions when the user click on it but what I am looking for is to delay the program until the user click the button . Anybody please ?
Anonymouse Posted June 21, 2008 Posted June 21, 2008 Thanks but your code is to let the button do some actions when the user click on it but what I am looking for is to delay the program until the user click the button . Anybody please ?I don't have enough information in that "example" script... my only solution with that little information would have to be:If Not $button ThenDoSleep(100)Until$buttonEndIf children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Bot Posted June 21, 2008 Author Posted June 21, 2008 I have tried but this doesn't work. Can anybody provide me a solution please ?
LongBowNZ Posted June 21, 2008 Posted June 21, 2008 Maybe you're looking for something more like this: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) GUICreate("GUI") GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") $Submit = GUICtrlCreateButton("Submit", 5, 5, 100) GUICtrlSetOnEvent(-1, "Buttonclicked") GUISetState() While 1 Sleep(10) WEnd Func Buttonclicked() ; Do Stuff ConsoleWrite("Button Clicked" & @CRLF) EndFunc Func Quit() Exit EndFunc
AdmiralAlkex Posted June 21, 2008 Posted June 21, 2008 You could use something like: Do Sleep(25) Until GUIGetMsg() = $Submit But I got to say I don't understand what good it would do at that place you showed in post#1 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
rasim Posted June 21, 2008 Posted June 21, 2008 BotMayb this be easier?#include <GuiConstantsEx.au3> GUICreate("Test", 300, 200) $input = GUICtrlCreateInput("", 80, 50, 150, 20) $SubmitButton = GUICtrlCreateButton("Submit", 110, 100, 75, 23) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $SubmitButton $InputRead = GUICtrlRead($input) If $InputRead <> "" Then ;Some action here ConsoleWrite($InputRead & @LF) EndIf EndSwitch WEnd
Bot Posted June 21, 2008 Author Posted June 21, 2008 Thank you so much for your answers I will test them later
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