« Return to Thread: Speed Counters

Re: Speed Counters

by Michael Steinwede-2 :: Rate this Message:

Reply to Author | View in Thread

Hi Tom,

Well, I did what you've suggested below, made sure the ON TIMER event  
on the form is selected, but nothing.

Well, not quite. It increments and decrements OK as before, but no  
speed counting takes place.

I have two issues, however.

(1) When I put a trace on to see what was happening, I noticed that in  
the object method, the hb_UpTime is set to 1 (which you would expect),  
but when the routine jumps to On Timer, the button hb_UpTime was reset  
to 0. So the large part of the On Timer routine is never activated.
(I'm not concerned with the other button, hb_DownTime - see code below  
- as I'm just trying to see how one button works and once I know that,  
I can set up the other buttons appropriately with various tests to  
ensure the On Timer event works for the button activated. I have eight  
buttons in all on the form that I want to use the speed counter.)

(2) Why do we have an increment counter in the Object method AND in  
the Form method in the On Timer event?

Many thanks for your comments.

Michael

Here's my code for the Form Method

        : (Form event=On Load )
                C_LONGINT(tempcounter)
                C_LONGINT($x;$y; vn_CareTime)
                tempcounter:=0
                vn_CareTime:=0
               
        : (Form event=On Timer )
                GET MOUSE($x;$y;hb_UpTime)
                If (hb_UpTime=1)
                        tempcounter:=tempcounter+1
                        vn_CareTime:=vn_CareTime+1
                        Case of
                                : (tempcounter>12)
                                        SET TIMER(2)
                                : (tempcounter>9)
                                        SET TIMER(4)
                                : (tempcounter>6)
                                        SET TIMER(6)
                                : (tempcounter>3)
                                        SET TIMER(8)
                        End case
                Else
                        SET TIMER(0)
                End if

And here's my code for the Object Method of my button (hb_UpTime)

        : (Form event=On Clicked )
                vn_CareTime:=vn_CareTime+1
                SET TIMER(10)
                If (vn_CareTime=200)
                        DISABLE BUTTON(hb_UpTime)
                Else
                        ENABLE BUTTON(hb_DownTime)
                End if


**********************************************************************
4D Basics hosted by 4D, Inc.                       http://www.4D.com/

Register for 4D Summit 2009 Today
Early Bird Pricing Ends August 28th - http://www.4D.com/summit

To Unsubscribe:                        mailto:4DBasics-off@...
**********************************************************************


 « Return to Thread: Speed Counters