Recent

Author Topic: Works in Delphi....  (Read 3300 times)

james

  • New Member
  • *
  • Posts: 13
Works in Delphi....
« on: February 08, 2011, 05:53:20 pm »
This doesn't work in Lazarus.  Am I missing maybe needing to add a unit?

procedure TForm3.Edit2Change(Sender: TObject);
begin
 (this part here -->) if Key in ['0'..'9','A'..'Z','a'..'z'] then
 begin
 Exit;
 end else
ShowMessage('You may use ONLY a combination of: a-z, A-Z, 0-9')
Key:=#0;
end;   

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Works in Delphi....
« Reply #1 on: February 08, 2011, 06:01:20 pm »
Because "Key" is unknown. You need to put this on an OnKey event handler where Key is a parameter.
« Last Edit: February 08, 2011, 06:28:37 pm by typo »

james

  • New Member
  • *
  • Posts: 13
Re: Works in Delphi....
« Reply #2 on: February 08, 2011, 06:14:45 pm »
Thanks. 

OnKeyPress to be exact.

 

TinyPortal © 2005-2018