Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
* Modified on 2013-12-07
* One does not need to use the old code as was posted 2007-05-28.
* Add the following line to the beginning of the .click() event, i.e. disable the command button.
this.enabled = .f.
* and also add the following line in the .valid() of the command button, i.e. enable the command button again
this.enabled = .t.
* ---------------------------------------------------------------------------------------
* OneClick.prg
* Date : 2007-05-28
*
* How to Test
* Click Multiple times on OneClick CommandButton within a short period of time.
* You will notice that OneClick will execute its code only once.
*
* Click Multiple times on MultiClick CommandButton within a short period of time.
* MultiClick will executes its code as many times as clicked.
*
* Implementation:
* Copy the code from OneClick.Valid() procedure to the valid() of your
* CommandButton. Do not need to modify any other parameters or code of your
* application.
*
Public obj_test
obj_test = Newobject("OneClick")
obj_test.Show()
Return
Define Class OneClick As Form
DoCreate = .T.
Name = "OneClick"
Caption = "Do not click me more than Once"
Add Object cmdOneClick As CommandButton With ;
Caption = 'OneClick', ;
Height = 60, ;
Top = 10, ;
Left = 10
Add Object cmdMultiClick As CommandButton With ;
Caption = 'MultiClick', ;
Height = 60, ;
Top = 90, ;
Left = 10
Add Object txtShowResult As EditBox With ;
Height = 160, ;
Top = 10, ;
Left = 160
Procedure Init
Return
Procedure cmdOneClick.Click
Local t_i
With Thisform.txtShowResult
.Value = .Value + "One - " + Time() + Chr(13)
Endwith
* Add some strain
For t_i = 1 To 1000000*40
Endfor
Endproc
Procedure cmdOneClick.Valid
Local t_j
*
* Each iteration adds .06 seconds delay. so choose the t_Max
* according to your requirements
#Define t_Max 50
* Now Remove all Clicks
For t_j = 1 To t_Max
= Inkey('HME')
endfor
endproc
Procedure cmdMultiClick.Click
Local t_i
With Thisform.txtShowResult
.Value = .Value + "Multi - " + Time() + Chr(13)
Endwith
* Add some strain
For t_i = 1 To 1000000*40
Endfor
Endproc
Enddefine