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 attributeCodePudding user response:
OnKeyPress or OnKeyDown suits mostCodePudding user response:
S11 method looks more lines, I try first, thank you!CodePudding user response:
MaskEdit1KeyPressIf Length (MaskEdit1. Text)=0 then
The begin
If not (key [in the 'A', 'B', 'A', 'B']) then
The begin
Key:=# 0;
end;
end;