how to validate Edit to only numbers & only text in inno setup? [duplicate]

非 Y 不嫁゛ 提交于 2019-12-10 11:57:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!