mianz Posted October 5, 2008 Share Posted October 5, 2008 hi guys. i have this problem. i know it's a very common problem but i don't know how to search for it. global $startstop While 1 $nMsg = GUIGetMsg() startbutton on click -> call function -> if $startstop = start then $startop = stop else $starstop = start Wend function abc() while $startstop = "start" blah blah endfunc ok, i know the computer is looping around function abc(), it is not detecting if startbutton is being click or not anymore. any tricks? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 5, 2008 Share Posted October 5, 2008 (edited) You need to change place between "abc()" and "if $startstop etc" and use OnEventMode. If you don't get it to work then make a small runnable reproducer and post that so we can help you. Edit: or do what bluelamp did Edited October 5, 2008 by AdmiralAlkex .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 Link to comment Share on other sites More sharing options...
bluelamp Posted October 5, 2008 Share Posted October 5, 2008 (edited) Opt("GUIOnEventMode", 1) GUICreate("t",400,400) GUISetOnEvent(-3,"_EXIT") GUIctrlSetOnEvent(GUICtrlCreateButton("Click",200,200,100),"_POLLING") global $startstop = 0 GUISetState(@SW_SHOW) While 1 Sleep(1000) abc() Wend Func _EXIT() Exit EndFunc Func _POLLING() if $startstop == 1 Then $startstop = 0 else $startstop = 1 EndIf EndFunc func abc() $i=0 while $startstop == 1 ConsoleWrite($i&@CRLF) $i+=1 WEnd endfunc This is an example how you could do it Edited October 5, 2008 by bluelamp Link to comment Share on other sites More sharing options...
mianz Posted October 6, 2008 Author Share Posted October 6, 2008 yeah. oneventmode works like a charm, still buggy. will update it's status 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