source: branches/Xvcl/Applications/TestApplication.pas

Last change on this file was 24, checked in by chronos, 12 years ago
  • Fixed: Make only one form focused at once.
  • Modified: Enhanced TList generic class to support more methods.
File size: 1.5 KB
Line 
1unit TestApplication;
2
3interface
4
5uses
6 Vcl.Graphics, Xvcl.Controls, Xvcl.Classes, Xvcl.Forms, SysUtils;
7
8type
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
19implementation
20
21uses
22 Xvcl.Kernel;
23
24{ TTestApplication }
25
26procedure TTestApplication.ButtonClick(Sender: TObject);
27begin
28 Button.Caption := 'Clicked';
29 Label1.Caption := IntToStr(StrToInt(Label1.Caption) + 1);
30end;
31
32procedure TTestApplication.Run;
33begin
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;
60end;
61
62end.
63
Note: See TracBrowser for help on using the repository browser.