Home > Back-end >  How to get the mouse clicks in Delphi
How to get the mouse clicks in Delphi

Time:05-14

Edit1 form, for the Label1, Label2, Label3, Label4, Label5, run after random manually enter a value in the Edit1 box (for example 5), click for the later to save 5 on Label1; Again random manually enter a value in the Edit1 box (such as 32), click for the later to save 32 on Label2; Again random manually enter a value in the Edit1 box (49), for example, click for the later to save 49 on Label2; And so on, Label1 - Label5, no duplicate values are allowed in (master)

CodePudding user response:

How to access Delphi mouse clicks
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1 under the form private statement FCounter: integer; Field for count
2 in form onCreate initialization FCounter:=0;
3 in the above controls onm ouseUp count (inc (FCounter));
4 what time want to check out counter, showmessage (inttostr (Fcounter));

CodePudding user response:

refer to the original poster hutjtwvnftj response:
Edit1 form, for the, Label1, Label2, Label3, Label4, Label5, run after random manually enter a value in the Edit1 box (for example 5), click for the later to save 5 on Label1; Again random manually enter a value in the Edit1 box (such as 32), click for the later to save 32 on Label2; Again random manually enter a value in the Edit1 box (49), for example, clicking on the Butt...


This description is a little round, can you describe clearly some more

CodePudding user response:

The puzzling questions, title and content have a dime relationship

CodePudding user response:

refer to the original poster hutjtwvnftj response:
Edit1 form, for the, Label1, Label2, Label3, Label4, Label5, run after random manually enter a value in the Edit1 box (for example 5), click for the later to save 5 on Label1; Again random manually enter a value in the Edit1 box (such as 32), click for the later to save 32 on Label2; Again random manually enter a value in the Edit1 box (49), for example, click to save 49 in the Lab after for the...



Simple way: you will save edit1 values to an array, according to the form of a circular queue operations,
Not allowed in the array have the same value

CodePudding user response:

In the first place in the onkeydown edit1 write restrictions, can only input Numbers,
A global variable count: integer
In the form of creation or onshow event to the count value assignment of 0
For the onclick event
The begin//judge the value of the count
If the count=4 then count=0;
If count<> 4 then
The begin
If label1. Text=edit1. Text then
The begin
Showmessage (' repeated input number);
exit;
end;
.
//label1 to 5 all judgment
If the count=0 then
The begin
Label1. Text:=edit1. Text;
exit;
end;
.
//label1 to 5 all judgment assignment
end;
End.

  • Related