Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Continuous mousedown
Message
 
 
To
28/09/2006 15:47:39
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01157829
Message ID:
01157983
Views:
19
Carlos,

Thierry didn't really state how fast he wanted the repetition to run, and it depends on the how long the process takes to determine how fast it repeats. With a normal click on the button the counter had already gotten to about 600 on my test form. To distinguish between a click and a hold down I'd put a loop at the top based on _dblclick and only start the repeats once that threshold has been exceeded.
* cmd.MouseDown()

local lnNow

this.VisualEffect = 2

lnNow = seconds()
do while mdown() and ( abs( seconds() - lnNow ) < _dblclick )
   doevents
enddo

do while mdown()
   * do repetitive thing
   thisform.text1.Value = thisform.text1.Value + 1
   thisform.text1.Refresh() 
enddo

this.VisualEffect = 0
>The "problem" I see with your code is that there is no "buffer" between the time the user presses the button and the moment the repetitive task begins. I tested it with for example, creating a GUID, I managed to get 10-20 GUIDS created by clicking the button once really fast. This can be bad or good, it depends.
>
>Depending on what needs to be done, a 500 to 1000 milliseconds wait time before the repetitive task starts works like a kind if "implicit" "Are you shure? messagebox".
>
>Also adding some time between each repetitive task could be good, or bad, depends on whats needs to be done. The interval could be adjusted in the timer event to make things "accelerate" over time, for example (stealing some of your code):
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform