anOparator Active Member Licensed User Longtime User Oct 2, 2016 #1 I have a next and a previous button, each will: increment 3 process_globals in Starter, run 3 Subs loading a bitmap in 3 seperate imageviews and do 3 kvs.Put statements. If I click a button too fast too many times my counter variable goes from 13, 14, 15 to 116. Would DoEvent in Button_Click be a way to prevent this or is there a better way?
I have a next and a previous button, each will: increment 3 process_globals in Starter, run 3 Subs loading a bitmap in 3 seperate imageviews and do 3 kvs.Put statements. If I click a button too fast too many times my counter variable goes from 13, 14, 15 to 116. Would DoEvent in Button_Click be a way to prevent this or is there a better way?
Erel B4X founder Staff member Licensed User Longtime User Oct 2, 2016 #2 anOparator said: Would DoEvent in Button_Click be a way to prevent this Click to expand... No. Code: Sub Button1_Click If DateTime.Now - LastActionTime < 300 Then Return LastActionTime = DateTime.Now ... End Sub LastActionTime is a process global variable. Upvote 0
anOparator said: Would DoEvent in Button_Click be a way to prevent this Click to expand... No. Code: Sub Button1_Click If DateTime.Now - LastActionTime < 300 Then Return LastActionTime = DateTime.Now ... End Sub LastActionTime is a process global variable.
anOparator Active Member Licensed User Longtime User Oct 5, 2016 #3 and a Long one at that , 200 is too small, 300 is just right. It turns 10 rapid Click events nto 5. Thanks for the IDEa. Upvote 0
and a Long one at that , 200 is too small, 300 is just right. It turns 10 rapid Click events nto 5. Thanks for the IDEa.
D DPaul Active Member Licensed User Longtime User Oct 7, 2016 #4 Without me knowing how many clicks are to be expected... Why don't you consider long_clicks ? That would slow it down. Upvote 0
Without me knowing how many clicks are to be expected... Why don't you consider long_clicks ? That would slow it down.
anOparator Active Member Licensed User Longtime User Oct 7, 2016 #5 DPaul said: Without me knowing how many clicks are to be expected... Why don't you consider long_clicks ? That would slow it down. Click to expand... There's no way of knowing how fast the end user will click the button, I merely wanted to protect Counter1 from very rapid Button1_Clicks. Long_click has its' use but not in this case, the code snippet above is more user friendly with a Tap-Tap-Tap feel, more adjustable, and does the job at 300 milliseconds. Thanks for mentioning the long_click option. Upvote 0
DPaul said: Without me knowing how many clicks are to be expected... Why don't you consider long_clicks ? That would slow it down. Click to expand... There's no way of knowing how fast the end user will click the button, I merely wanted to protect Counter1 from very rapid Button1_Clicks. Long_click has its' use but not in this case, the code snippet above is more user friendly with a Tap-Tap-Tap feel, more adjustable, and does the job at 300 milliseconds. Thanks for mentioning the long_click option.