« Return to Thread: Speed Counters

RE: Speed Counters

by Bill Thompson-7 :: Rate this Message:

Reply to Author | View in Thread

I think your 'case of ' tempcounters might be in the wrong order...

-----Original Message-----
From: 4DBasics@... [mailto:4DBasics@...] On Behalf Of
Thomas Fitch
Sent: Thursday, June 04, 2009 10:47 AM
To: 4D Basics List
Subject: RE: Speed Counters

Hi Michael,

This is just pseudo-4D Code, I did not test it or run it, but the
commands
you need should be correct.

Place this in the button method:
Case of
  :(form event = on clicked)
    counter:=counter+1
    SET TIMER (10)
End Case

Place this in the form method and make sure the On timer form event is
selected from the form properties:
Case of
  :(form event = on load)
    C_LONGINT(counter;tempcounter)
    counter:=0
    tempcounter:=0
  :(form event = on timer)
    GET MOUSE($x;$y;$button)
    If($button=1)
      tempcounter:=tempcounter+1
      counter:=counter+1
      case of
        :(tempcounter > 3)
          SET TIMER(8)
        :(tempcounter > 6)
          SET TIMER(6)
        :(tempcounter > 9)
          SET TIMER(4)
        :(tempcounter > 12)
          SET TIMER(2)
      End case
    Else
      SET TIMER(0)
End Case

This way when you click you increment, and you set the form timer. If
you
hold the mouse button down the timer keeps running (see the GET MOUSE
command). The longer the mouse button is down (aka the more times On
timer
event fires) the faster On timer fires and the faster counter gets
incremented. You can obviously play with the numbers so it works for
you.

Kind Regards,

Tom Fitch
Technical Services Team Member
4D, Inc.


**********************************************************************
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@...
**********************************************************************



**********************************************************************
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