| Line | |
|---|
| 1 | unit AppTest;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Classes, SysUtils, Api, DateUtils;
|
|---|
| 7 |
|
|---|
| 8 | type
|
|---|
| 9 |
|
|---|
| 10 | { TAppTest }
|
|---|
| 11 |
|
|---|
| 12 | TAppTest = class(TApp)
|
|---|
| 13 | procedure Run(Context: TAppContext); override;
|
|---|
| 14 | constructor Create; override;
|
|---|
| 15 | end;
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | implementation
|
|---|
| 19 |
|
|---|
| 20 | { TAppTest }
|
|---|
| 21 |
|
|---|
| 22 | procedure TAppTest.Run(Context: TAppContext);
|
|---|
| 23 | var
|
|---|
| 24 | Handle: THandle;
|
|---|
| 25 | Pos: TPoint;
|
|---|
| 26 | begin
|
|---|
| 27 | with Context.Api do begin
|
|---|
| 28 | WriteLine('Hello World!');
|
|---|
| 29 | Sleep(OneSecond);
|
|---|
| 30 | RunApp('Code');
|
|---|
| 31 | Handle := CreateWindow;
|
|---|
| 32 | SetWindowName(Handle, 'New window');
|
|---|
| 33 | SetWindowRect(Handle, Bounds(100, 100, 400, 200));
|
|---|
| 34 | SetWindowVisible(Handle, True);
|
|---|
| 35 |
|
|---|
| 36 | Handle := CreateWindow;
|
|---|
| 37 | SetWindowName(Handle, 'Second window');
|
|---|
| 38 | SetWindowRect(Handle, Bounds(350, 150, 500, 300));
|
|---|
| 39 | SetWindowVisible(Handle, True);
|
|---|
| 40 |
|
|---|
| 41 | repeat
|
|---|
| 42 | Pos := GetMousePosition;
|
|---|
| 43 | SetWindowName(Handle, IntToStr(Pos.X) + ', ' + IntToStr(Pos.Y));
|
|---|
| 44 | Sleep(100 * OneMillisecond);
|
|---|
| 45 | until Terminated;
|
|---|
| 46 | end;
|
|---|
| 47 | end;
|
|---|
| 48 |
|
|---|
| 49 | constructor TAppTest.Create;
|
|---|
| 50 | begin
|
|---|
| 51 | Name := 'Test';
|
|---|
| 52 | end;
|
|---|
| 53 |
|
|---|
| 54 | end.
|
|---|
| 55 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.