1 | unit TestApplication;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Vcl.Graphics, Xvcl.Controls, Xvcl.Classes, Xvcl.Forms, SysUtils;
|
---|
7 |
|
---|
8 | type
|
---|
9 | TTestApplication = class(TApplication)
|
---|
10 | Form1: TForm;
|
---|
11 | Form2: TForm;
|
---|
12 | Button: TButton;
|
---|
13 | Label1: TLabel;
|
---|
14 | procedure Run; override;
|
---|
15 | procedure ButtonClick(Sender: TObject);
|
---|
16 | end;
|
---|
17 |
|
---|
18 |
|
---|
19 | implementation
|
---|
20 |
|
---|
21 | uses
|
---|
22 | Xvcl.Kernel;
|
---|
23 |
|
---|
24 | { TTestApplication }
|
---|
25 |
|
---|
26 | procedure TTestApplication.ButtonClick(Sender: TObject);
|
---|
27 | begin
|
---|
28 | Button.Caption := 'Clicked';
|
---|
29 | Label1.Caption := IntToStr(StrToInt(Label1.Caption) + 1);
|
---|
30 | end;
|
---|
31 |
|
---|
32 | procedure TTestApplication.Run;
|
---|
33 | begin
|
---|
34 | Form1 := TForm.Create;
|
---|
35 | Form1.Bounds := TRectangle.Create(50, 80, 200, 120);
|
---|
36 | Form1.Name := 'Form1';
|
---|
37 | Form1.Caption := 'Test application';
|
---|
38 | Form1.Screen := Screen;
|
---|
39 | Form2 := TForm.Create;
|
---|
40 | Form2.Bounds := TRectangle.Create(350, 150, 200, 150);
|
---|
41 | Form2.Name := 'Form2';
|
---|
42 | Form2.Caption := 'Some form';
|
---|
43 | Form2.Screen := Screen;
|
---|
44 | Button := TButton.Create;
|
---|
45 | Button.Parent := Form1;
|
---|
46 | Button.Bounds := TRectangle.Create(50, 50, 60, 24);
|
---|
47 | Button.Visible := True;
|
---|
48 | Button.Caption := 'Start';
|
---|
49 | Button.OnClick := ButtonClick;
|
---|
50 | Form1.Controls.Add(Button);
|
---|
51 | Label1 := TLabel.Create;
|
---|
52 | Label1.Parent := Form1;
|
---|
53 | Label1.Bounds := TRectangle.Create(60, 80, 60, 24);
|
---|
54 | Label1.Visible := True;
|
---|
55 | Label1.Caption := '0';
|
---|
56 | Form1.Controls.Add(Label1);
|
---|
57 | TScreen(Screen).Forms.Add(Form1);
|
---|
58 | TScreen(Screen).Forms.Add(Form2);
|
---|
59 | TScreen(Screen).Paint;
|
---|
60 | end;
|
---|
61 |
|
---|
62 | end.
|
---|
63 |
|
---|