问题
Is there a way to limit the characters to numbers and lenght to 10 with no space and another edit for just ? its for a phone number, and name that needs to have no spaces, dont have an idea how to do it. Found a code that try some ways to implement but dont work here is what I found for dont allow letters.
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key in ['a'..'z']) or (Key in ['A'..'Z']) then
Key := #0;
end;
Here for dont allow numbers:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key in ['0'..'9'] then
Key := #0;
end;
and this for no space:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key = Char(VK_SPACE) then
Key := #0;
end;
can implement something similar in inno?
回答1:
You can edit MaxLength property of Edit1 to limit character
Edit1.MaxLength:=10;
来源:https://stackoverflow.com/questions/44598901/how-to-validate-edit-to-only-numbers-only-text-in-inno-setup