title: how to disable certain keys in delphi
body: <p>I have added the following code to my program which, as i understood, must disable alphabets from being entered.
  I set the form's KeyPreview property to True,
  Next i added this code</p>
  
  <pre><code>procedure FormKeyPress(Sender: TObject; var Key: Char) ;
  </code></pre>
  
  <p>which was defined as</p>
  
  <pre><code> procedure TFibo.FormKeyPress(Sender: TObject; var Key: Char);
    begin
   if Key in ['a'..'z'] then Key := #0
    end;
  </code></pre>
  
  <p>This does not seem to work, as i am able to enter a-z in  the form's edit components; what am i doing wrong?</p>
  
  <p>This is the code for my program</p>
  
  <pre><code> unit Unit1;
  
   interface
  
   uses
     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
     Dialogs, StdCtrls;
  
   type
     TFibo = class(TForm)
     lblInput: TLabel;
     edtInput: TEdit;
     procedure FormKeyPress(Sender: TObject; var Key: Char) ;
   end;
  
  var
    Fibo: TFibo;
  
  implementation
  
  {$R *.dfm}
  
  procedure Tfibo.FormKeyPress(Sender:TObject;var Key:char);
  begin
    if Key in ['a'..'z', 'A'..'Z'] then
      Key := #0
  end;
  
  end.
  </code></pre>