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 | |
---|
1 | unit Driver.KeyboardVCL;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Vcl.Forms, Vcl.Controls, System.Classes, UFormMain, Xvcl.Classes, Xvcl.Kernel;
|
---|
7 |
|
---|
8 | type
|
---|
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 |
|
---|
22 | implementation
|
---|
23 |
|
---|
24 | { TDriverKeyboardVCL }
|
---|
25 |
|
---|
26 | procedure TDriverKeyboardVCL.DoKeyDown(Sender: TObject; var Key: Word;
|
---|
27 | Shift: TShiftState);
|
---|
28 | begin
|
---|
29 | Kernel.Keyboard.KeysState[Key] := True;
|
---|
30 | end;
|
---|
31 |
|
---|
32 | procedure TDriverKeyboardVCL.DoKeyUp(Sender: TObject; var Key: Word;
|
---|
33 | Shift: TShiftState);
|
---|
34 | begin
|
---|
35 | Kernel.Keyboard.KeysState[Key] := False;
|
---|
36 | end;
|
---|
37 |
|
---|
38 | procedure TDriverKeyboardVCL.Finalize;
|
---|
39 | begin
|
---|
40 | inherited;
|
---|
41 |
|
---|
42 | end;
|
---|
43 |
|
---|
44 | procedure TDriverKeyboardVCL.Initialize;
|
---|
45 | begin
|
---|
46 | inherited;
|
---|
47 | Form := Application.MainForm;
|
---|
48 | Form.OnKeyDown := DoKeyDown;
|
---|
49 | Form.OnKeyUp := DoKeyUp;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.