source: os/trunk/Applications/TestApplication.pas

Last change on this file was 14, checked in by chronos, 8 years ago
  • Modified: TForm title bar implemented using controls.
File size: 1.9 KB
Line 
1unit TestApplication;
2
3interface
4
5uses
6 Vcl.Graphics, Xvcl.Controls, Xvcl.Classes, Xvcl.Forms, LDOS.Kernel, SysUtils;
7
8type
9 TTestApplication = class(TApplication)
10 Form1: TForm;
11 Form2: TForm;
12 Button: TButton;
13 Label1: TLabel;
14 Edit1: TEdit;
15 Timer1: TTimer;
16 procedure Run; override;
17 procedure ButtonClick(Sender: TObject);
18 end;
19
20
21implementation
22
23{ TTestApplication }
24
25procedure TTestApplication.ButtonClick(Sender: TObject);
26begin
27 Button.Caption := 'Clicked';
28 Label1.Caption := IntToStr(StrToInt(Label1.Caption) + 1);
29end;
30
31procedure TTestApplication.Run;
32begin
33 Caption := 'TestApp';
34 Form1 := TForm.Create;
35 Form1.Owner := Self;
36 Form1.Bounds := TRectangle.Create(50, 80, 200, 120);
37 Form1.Name := 'Form1';
38 Form1.Caption := 'Test application';
39 Form1.Screen := Screen;
40 Form1.Application := Self;
41 Form2 := TForm.Create;
42 Form2.Owner := Self;
43 Form2.Bounds := TRectangle.Create(350, 150, 200, 150);
44 Form2.Name := 'Form2';
45 Form2.Caption := 'Some form';
46 Form2.Screen := Screen;
47 Form2.Application := Self;
48 Timer1 := TTimer.Create;
49 Timer1.Interval := 1000;
50 Timer1.Enabled := True;
51 TScreen(Screen).Kernel.Timers.Add(Timer1);
52 Button := TButton.Create;
53 Button.Parent := Form1;
54 Button.Owner := Form1;
55 Button.Bounds := TRectangle.Create(50, 50, 60, 24);
56 Button.Visible := True;
57 Button.Caption := 'Start';
58 Button.OnClick := ButtonClick;
59 Label1 := TLabel.Create;
60 Label1.Parent := Form1;
61 Label1.Owner := Form1;
62 Label1.Bounds := TRectangle.Create(60, 80, 60, 24);
63 Label1.Visible := True;
64 Label1.Caption := '0';
65 Edit1 := TEdit.Create;
66 Edit1.Parent := Form2;
67 Edit1.Owner := Form2;
68 Edit1.Bounds := TRectangle.Create(60, 80, 60, 24);
69 Edit1.Visible := True;
70 Edit1.Text := 'Text';
71 MainForm := Form1;
72 TScreen(Screen).Forms.Add(Form1);
73 TScreen(Screen).Forms.Add(Form2);
74 TScreen(Screen).Paint;
75end;
76
77end.
78
Note: See TracBrowser for help on using the repository browser.