Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command button double click
Message
From
31/07/2006 23:34:27
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01141975
Message ID:
01142007
Views:
11
>How can you keep a user from clicking the same command button more than once. They do a double click and spawn the click event twice.

I think training the users, as explained in my other message, would be the best solution.

The other alternative, a little more complicated, would be to set a form property (or a property for the button) in the button Click() Event, indicating at what moment the button was clicked. When the button is clicked a second time, the Click() Event compares this property, to see how much time has elapsed. If too little time has elapsed, nothing is done. Something like this:
* Button.Init()
This.AddProperty("tStartTime", datetime())

* Button Click()
if datetime() - This.tStartTime < 0.5 && half a second
  ?? chr(7) && Alert user
  return && do nothing
endif
This.tStartTime = datetime()
* Do the button's job here
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform