Home > Back-end >  Form 1 and form 2 each a button, only the click event, but the button, double-click the form 1 will
Form 1 and form 2 each a button, only the click event, but the button, double-click the form 1 will

Time:11-06

The form 1 and form 2, each a Button, the form 1 Button click event, is to open the form 2, two buttons position is in the middle of the screen, double-click the form 1 Button now, will perform the form 2 Button click event, is there any way can make the form 2 Button click is invalid for the first time

CodePudding user response:

Get a timing
 

Procedure TForm2. OnBtnClick (sender: TObject);
The begin
//form to create to the click event, if (according to the need to adjust) within 1 second, think the invalid clicks,
If (GetTickCount - FTick) & lt; 1000 then the exit;
ShowMessage (' you click me ');
end;

Procedure TForm2. FormCreate (Sender: TObject);
The begin
FTick:=GetTickCount ();
For the OnClick:=OnBtnClick;
end;

CodePudding user response:

Define an integer or other variables, after the first click BTN, the integer variables set to 1, the second button clicks to judge the value of the integer before if not equal, not executed (the default value is 0 integer variables)

CodePudding user response:

Apparently you combo of

CodePudding user response:

Apparently you combo of
  • Related