|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
Speed CountersCould anyone direct me to some example or article that tells me how to
create a speed counter. That is, when you click on a button, the counter is incremented by 1. If I hold the button down for, say 2 secs, the counter automatically increments by 1 at a faster speed until the button is released (or until max value is reached). Or if the button is continually held down for, say 5 secs, the counter automatically increments by 1 at a very fast speed until the button is released (or until max value is reached). I remember seeing an article on this some years ago, but can't find it now on 4D. It could be that I searching with the wrong criteria. Any help appreciated. Michael ********************************************************************** 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@... ********************************************************************** |
|
|
Re: Speed CountersI used a simple modifier (shift key) to increase the speed. Clicking the
plus adds one item to the count. Holding the shift and clicking adds 10 at a time. Sorry, don't know how to auto increase based on the length of time held. -- | Douglas S. Davis - Information Systems Coordinator | Monical Pizza Corporation (http://www.monicals.com) | - - - - - - - - - - | 815/937-1890 - Voice . . . 815/937-9828 - Fax -- ********************************************************************** 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@... ********************************************************************** |
|
|
|
|
|
|
|
|
|
|
|
Re: Speed CountersHi Douglas,
Interestingly, I have another software application program that does almost the same thing to jump by 10 (that is, hold down the shift key while clicking a button), but it never occurred to me to try in my database. It's not what I'm wanting in my particular case, but worth keeping in mind for another time. Many thanks, Michael. On 04/06/2009, at 10:59 PM, Douglas Davis wrote: > I used a simple modifier (shift key) to increase the speed. > Clicking the > plus adds one item to the count. Holding the shift and clicking > adds 10 at > a time. Sorry, don't know how to auto increase based on the length > of time > held. ********************************************************************** 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@... ********************************************************************** |
|
|
Re: Speed CountersHi 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@... ********************************************************************** |
|
|
|
|
|
Re: Speed CountersHi Tom,
On 06/06/2009, at 2:18 AM, Thomas Fitch wrote: > The method I suggested isn't going to work with a button. I do have > another > suggestion though... use a picture variable. :-) > > > I outline it in this tech tip: > > http://kb.4d.com/search/assetid=75706 > > The tech tip discusses how to implement drag and drop in SVG images > but you > can use the same idea to implement a speed counter. Use the Mouse > Enter, > Mouse Leave, and On Clicked events of the picture variable to manage > the > Timer and then handle the incrementing via the On Time form event. I couldn't get your second suggestion to work either. However, looking up Form events I came across this ... For all these objects, the On Clicked event occurs once the mouse button is released. However, there are several exceptions: • Invisible buttons - The On Clicked event occurs as soon as the click is made and does not wait for the mouse button to be released. Remembering your earlier comments, I tried invisible buttons and with a few adjustments, I was able to get it to work! Thanks for your input and suggestions, it gave me all the clues I needed and learnt heaps. Michael. PS. Here's the code I used. Invisible button Object Method code ... : (Form event=On Clicked ) UserButtonDown:=True SET TIMER(10) If (vn_CareTime=20) DISABLE BUTTON(bi_UpTime) SET TIMER(0) Else vn_CareTime:=vn_CareTime+0.25 ENABLE BUTTON(bi_DownTime) End if Form Method Code ... : (Form event=On Load ) C_LONGINT(iCnt) C_LONGINT($x;$y;$MouseState) `// not used, but needed for On Timer event below C_BOOLEAN(UserButtonDown) UserButtonDown:=False iCnt:=0 : (Form event=On Timer ) GET MOUSE($x;$y;$MouseState) `// get mouse state If (($MouseState=1) & (UserButtonDown)) `// 1 = mouse button down If (vn_CareTime=20) SET TIMER(0) UserButtonDown:=False iCnt:=0 Else iCnt:=iCnt+1 vn_CareTime:=vn_CareTime+0.25 Case of : (iCnt>20) `// go very fast SET TIMER(2) : (iCnt>5) `// go faster SET TIMER(15) : (iCnt<5) `// go slowly SET TIMER(25) End case End if Else SET TIMER(0) UserButtonDown:=False iCnt:=0 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@... ********************************************************************** |
| Free embeddable forum powered by Nabble | Forum Help |