source: trunk/Packages/bgracontrols/testbgracontrols/ubgraimagebuttontest.pas

Last change on this file was 2, checked in by chronos, 5 years ago
File size: 1.6 KB
Line 
1{ See NOTICE.txt for the Android buttons. }
2
3unit ubgraimagebuttontest;
4
5{$mode objfpc}{$H+}
6
7interface
8
9uses
10 Forms, Controls, BGRAImageButton, BGRABitmap,
11 BGRABitmapTypes, Dialogs;
12
13type
14
15 { TfrmMain }
16
17 Tfrmibtest = class(TForm)
18 android_14_dark: TBGRAImageButton;
19 android_14_normal: TBGRAImageButton;
20 android_dark: TBGRAImageButton;
21 android_normal: TBGRAImageButton;
22 sample_1: TBGRAImageButton;
23 sample_2: TBGRAImageButton;
24 sample_3: TBGRAImageButton;
25 sample_4: TBGRAImageButton;
26 sample_5: TBGRAImageButton;
27 sample_6: TBGRAImageButton;
28 sample_7: TBGRAImageButton;
29 procedure FormCreate(Sender: TObject);
30 procedure sample_2Click(Sender: TObject);
31 private
32 { private declarations }
33 public
34 { public declarations }
35 end;
36
37var
38 frmibtest: Tfrmibtest;
39
40implementation
41
42uses
43 BGRASamples;
44
45{$R *.lfm}
46
47{ TfrmMain }
48
49procedure Tfrmibtest.FormCreate(Sender: TObject);
50var
51 i: integer;
52begin
53 {$IFDEF WINDOWS}
54 DoubleBuffered := True;
55 {$ENDIF}
56
57 { Load all the button images from file according to name}
58 for i := 0 to Self.ControlCount - 1 do
59 if Self.Controls[i] is TBGRAImageButton then
60 TBGRAImageButton(Self.Controls[i]).BitmapLoadFromFile(TBGRAImageButton(Self.Controls[i]).Name + '.png');
61
62 { BGRASamples DrawFacebookImageButton }
63 DrawFacebookImageButton(sample_6);
64end;
65
66procedure Tfrmibtest.sample_2Click(Sender: TObject);
67var
68 i: integer;
69begin
70 { Switch Enable in all controls in the form }
71 for i := 0 to Self.ControlCount - 1 do
72 Self.Controls[i].Enabled := not Self.Controls[i].Enabled;
73
74 { Enable this button }
75 TControl(Sender).Enabled := True;
76end;
77
78end.
79
Note: See TracBrowser for help on using the repository browser.