Guest fafot Posted April 25, 2005 Posted April 25, 2005 I created a combo box. I also have a timer loop.My timer is set for 5 seconds so I have to be quick if I want to select any other value - and I don't like this... My question is:How to get a control that will stop the timer at the moment the combo box is clicked?Thank you.
buzz44 Posted April 25, 2005 Posted April 25, 2005 (edited) I don't think you can actaully 'stop' a timer. You can just reset it. Each time you 'call' it, or whatever you want to say, it resets it so.$begin = TimerInit() sleep(3000) $dif = TimerDiff($begin) MsgBox(0,"Time Difference",$dif) $begin = TimerInit() sleep(4000) $dif = TimerDiff($begin) MsgBox(0,"Time Difference",$dif)First mesage box will be about 3000 ms and the second will be about 4000, as I said before each time oyu start a timer it resets it. But you can have 2 timers going at the same time I think, eg.$Time_1 = TimerInit() $Time_2 = TimerInit()Not sure about that though.Edit: You can have 2 timers running at the same time. Edited April 25, 2005 by Burrup qq
Guest fafot Posted April 25, 2005 Posted April 25, 2005 Sorry I did not explained myself correctly:GUICtrlSetData($SizeRam_3,"48|64|96|128|Auto19","Auto19")For $i = 05 to 0 step -1 sleep(1000) GUICtrlSetData($Timer3, $i);;; Here I MUST select a value to get out of the loop $ConvRam = GUICtrlRead($SizeRam_3) if $convRam <> "Auto19" Then ExitLoopNextIf $I < 0 then Call ("SetRamDrive") else While 1 $msg = GUIGetMsg() WEndEndIfBy doing this I exited the timer loop and the timer stop counting but it happens only WHEN I select a value from the combo box and NOT when I click on it. I am looking for solution that will stop the timer - get me out of the loop - when I click on the combo box WITHOUT selecting any value.
buzz44 Posted April 26, 2005 Posted April 26, 2005 (edited) Ahhh my bad. I'll use an example instead so that you can modify it for your self .While 1 If GUICtrlRead($test) = "blah" Then ;Blah EndIf WendThat will do "blah" when the combo equals "blah". If you wanted it to do "blah" whenever you select a value you can use GUICtrlRead($test) <> "", which ensure that whenever you select a value it will do whatever, provided there isn't and entry in the list box with the contents "" . If you click on it and move your mouse over the contents it will perform "blah". Not when you click it.If you did want it when you click it. You would use GUIGetMsg()While 1 $msg = GuiGetMsg() If $msg = $test Then ;Blah EndIf WEnd Edited May 2, 2005 by Burrup qq
Guest fafot Posted May 2, 2005 Posted May 2, 2005 Tx for the answer. It still does not do the job the way I would like it but its ok for me.
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