home *** CD-ROM | disk | FTP | other *** search
- unit Keyev;
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- Memo1: TMemo;
- Button1: TButton;
- procedure Edit1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure Edit1KeyPress(Sender: TObject; var Key: Char);
- procedure Edit1KeyUp(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
-
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var
- s : string;
- begin
- s := '';
- if ssCtrl in Shift then s := s + 'CTRL-';
- if ssAlt in Shift then s := s + 'ALT-';
- if ssShift in Shift then s := s + 'SHIFT-';
- Memo1.Lines.Add( Format('Edit1KeyDown: Key Code: %d, Key = %s%s', [Key,s,Chr(Key)] ));
- if Key = vk_Multiply then
- Caption := 'The Multiply Key!'
- else
- Caption := Chr(Key);
- end;
-
- procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
- begin
- Memo1.Lines.Add( Format('Edit1KeyPress: Key = %s', [Key] ));
- end;
-
- procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var
- s : string;
- begin
- s := '';
- if ssCtrl in Shift then s := s + 'CTRL-';
- if ssAlt in Shift then s := s + 'ALT-';
- if ssShift in Shift then s := s + 'SHIFT-';
- Memo1.Lines.Add( Format('Edit1KeyUp: Key Code: %d, Key = %s%s', [Key,s,Chr(Key)] ));
- Memo1.Lines.Add( '----------------' );
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- Memo1.Clear;
- Edit1.SetFocus;
- end;
-
- end.
-