PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Stephane Fonteyne on September 15, 2007, 02:32:04 PM

Title: Examples Timers Nothing !
Post by: Stephane Fonteyne on September 15, 2007, 02:32:04 PM
Paul or others

Can someone post here an example that used Timers.

I have only this and that all



FUNCTION FORM1_TIMER1_WM_TIMER ( _
                               hWndForm      AS DWORD, _  ' handle of Form
                               wTimerID      AS DWORD  _  ' the timer identifier
                               ) AS LONG

END FUNCTION



1. Where can I set the Timer ? (StartTimer) ?
2. Where can I clear the Timer? (StopTimer) ?
3. I don't find in the WinAPI the functions StartTimer and StopTimer.
4. I know where I handle the events
5. Can you add wrappers FF functions for FF_StartTimer en FF_StopTimer

I hope that you understand me Paul but there is no example in the FF directory
Title: Re: Examples Timers Nothing !
Post by: David Kenny on September 15, 2007, 05:52:35 PM
Stephane,

I did a search on "timer" in the  FireFly Technical Assistance section (the one you posted your question in).

I found your post, of course, and one entitled How to Creating a Timer for FF in which Peter Jinks shows how to do what you are looking for.  He points out the two windows API calls SetTimer and KillTimer and gives an example of how to use them in FF.

Don't forget to use the search abilities of the forum, including the PB forum for that matter, before giving up and asking.  There is a vast wealth of information to learn from by some really talented people. And you can learn so much more when you do the research yourself.  ;)

Regards,

David

PS, I forgot to mention you can set the timer interval in the properties tab at design time.
Title: Re: Examples Timers Nothing !
Post by: Elias Montoya on September 16, 2007, 04:19:17 AM
 Stephane, Just add a timer control in your form.
You can add it just like you add any other control.
In the control properties you can specify the Interval
in the control properties.

1.- Create a form.
2.- Open the Firefly WorkSpace.
3.- Click in the Tools Tab.
4.- Click on TIMER CONTROL. Its the one with a clock.
5.- Add it to your form.
6.- Right Click on it and click "Control Properties"
7.- Specify the interval you want.
8.- Double click the Timer control (the clock in your form)
9.- Add the code you want to happen every time the timer hits the code.
10.- Click RUN to test it.

11.- Come back here and post that Firefly is Cool.

You are done.
Title: Re: Examples Timers Nothing !
Post by: Elias Montoya on September 16, 2007, 04:27:08 AM
 By the way... FF_StartTimer and FF_StopTimer are a Good idea,
Add my checkmark on that paul. :)
Title: Re: Examples Timers Nothing !
Post by: Jean-Pierre LEROY on September 16, 2007, 06:20:17 PM
Is-it possible to change the timer interval when the program is running ?

Thanks,
Jean-Pierre
Title: Re: Examples Timers Nothing !
Post by: Jean-Pierre LEROY on September 25, 2007, 07:47:52 AM
Hi,

I have 3 questions about timer :

1. how can I change the timer interval when the program is running ?
2. how can I to stop the timer ?
3. how can I re-start the timer ?

Thank you for your help.
Jean-Pierre
Title: Re: Examples Timers Nothing !
Post by: TechSupport on September 25, 2007, 08:21:18 AM
Here you go.

' Stop timer
KillTimer hWndForm, IDC_FORM1_TIMER1


' Start timer. You are essentially creating a new timer
' and specifying the new interval.
' 1000 represents the number of milliseconds of delay (1 second = 1000 milliseconds)
HWND_FORM1_TIMER1 = SetTimer( hWndForm, IDC_FORM1_TIMER1, 1000, ByVal %Null )       


' Change timer interval. You need to kill the original timer
' and create a new timer with the new interval. In this
' case the new interval is 2 seconds
KillTimer hWndForm, IDC_FORM1_TIMER1
HWND_FORM1_TIMER1 = SetTimer( hWndForm, IDC_FORM1_TIMER1, 2000, ByVal %Null )       


Let me know if it requires more explanation.

Thanks!

Title: Re: Examples Timers Nothing !
Post by: Jean-Pierre LEROY on September 26, 2007, 07:34:53 AM
Quote from: TechSupport on September 25, 2007, 08:21:18 AM
Let me know if it requires more explanation.
Hello Paul,

Thank you very much for your answer.
It's exactly what I was looking for.

Jean-Pierre