Home > Back-end >  How to use MaskEdit implementation limit users can only enter a few letters?
How to use MaskEdit implementation limit users can only enter a few letters?

Time:10-10

Such as:
How to use MaskEdit implementation limit users can only enter a few letters?
First letter can only input A and B, for example, input other letters are wrong,

CodePudding user response:

Response OnKeyPress events:
If TMaskEdit (Sender). SelStart=0 then
If not, the Key in [' A ', 'B']) then
The begin
Beep.
Key:=# 0
end

CodePudding user response:

Editmask matching conditions specified in the attribute

CodePudding user response:

OnKeyPress or OnKeyDown suits most

CodePudding user response:

S11 method looks more lines, I try first, thank you!

CodePudding user response:

MaskEdit1KeyPress

If Length (MaskEdit1. Text)=0 then
The begin
If not (key [in the 'A', 'B', 'A', 'B']) then
The begin
Key:=# 0;
end;
end;
  • Related