【发布时间】:2018-09-21 13:09:50
【问题描述】:
我正在尝试根据我的要求限制输入框中某些特殊字符的按键,我正在使用以下过程来做同样的事情。
procedure RestrictKeyPress(Sender: TObject; var Key: Char);
var
KeyCode: Integer;
begin
{ Restrict special characters @, ^, *, \ }
KeyCode := Ord(Key);
if ((KeyCode = 32) or (KeyCode >= 64) or (KeyCode <= 94) or (KeyCode <= 42) or (KeyCode <= 92)) then
Key := #0;
end;
我像这样在InitializeWizard 中调用这个过程
PageConfig.Edits[1].OnKeyPress := @RestrictKeyPress;
但是当我测试这个时,按键对任何键都不起作用。我试图只限制下面提到的键和空间。
@、^、*、\
【问题讨论】:
-
非常感谢肯。愚蠢的错误。