PDA

View Full Version : Where is timer?


Zharikov
06-28-2009, 01:16 PM
Hi!
Ask, please, how i can count several seconds and execut my function?
1. Click Button
2. Timer count 5 seconds
3. After timer my func

Thanks.

zehlein
06-28-2009, 04:18 PM
There is no wrapper around the time in PPL 1.x
To get a timer use SetTimer and to delete this timer use KillTimer.

eg:

In the VisualFormBuilder doubleclick the button you want to create a timer. Write

SetTimer(Form100$, 101, 5000, null);

(if you changed your form's name you have to change "Form100$" accordingly)
Now activate your form, click the "Events" tab and doubleclick the "OnTimer" event. Here you should place the code you wish to execute. Don't forget to kill the timer:

KillTimer(Form100$,101);

and you are done.

Zharikov
06-28-2009, 06:44 PM
But in traditional languages where use timer, write procedure:

sub timer()
BODY
end sub

and body in this procedure make many times. How loop.

How i can in PPL make it?

zehlein
06-29-2009, 03:30 PM
If you don't kill the timer the OnTimer event will be triggered forever (in our case) every 5000 msec. Which is right what you want - kind of a loop.

kornalius
07-04-2009, 11:37 PM
With Windows API the WM_TIMER message is sent to the window every iteration of the timer. You can then place code inside that WM_TIMER message handler.

OnTimer is easier to use, it is more visual.