source: branches/Xvcl/Drivers/Driver.KeyboardVCL.pas

Last change on this file was 19, checked in by chronos, 12 years ago
  • Added: Test implementation of custom VCL classes adapted to be used with virtual OS.
File size: 1.0 KB
Line 
1unit Driver.KeyboardVCL;
2
3interface
4
5uses
6 Vcl.Forms, Vcl.Controls, System.Classes, UFormMain, Xvcl.Classes, Xvcl.Kernel;
7
8type
9 TDriverKeyboardVCL = class(TDriver)
10 private
11 procedure DoKeyDown(Sender: TObject; var Key: Word;
12 Shift: TShiftState);
13 procedure DoKeyUp(Sender: TObject; var Key: Word;
14 Shift: TShiftState);
15 public
16 Form: Vcl.Forms.TForm;
17 procedure Initialize; override;
18 procedure Finalize; override;
19 end;
20
21
22implementation
23
24{ TDriverKeyboardVCL }
25
26procedure TDriverKeyboardVCL.DoKeyDown(Sender: TObject; var Key: Word;
27 Shift: TShiftState);
28begin
29 Kernel.Keyboard.KeysState[Key] := True;
30end;
31
32procedure TDriverKeyboardVCL.DoKeyUp(Sender: TObject; var Key: Word;
33 Shift: TShiftState);
34begin
35 Kernel.Keyboard.KeysState[Key] := False;
36end;
37
38procedure TDriverKeyboardVCL.Finalize;
39begin
40 inherited;
41
42end;
43
44procedure TDriverKeyboardVCL.Initialize;
45begin
46 inherited;
47 Form := Application.MainForm;
48 Form.OnKeyDown := DoKeyDown;
49 Form.OnKeyUp := DoKeyUp;
50end;
51
52end.
Note: See TracBrowser for help on using the repository browser.