1{
2 ***************************************************************************
3 *                                                                         *
4 *   This source is free software; you can redistribute it and/or modify   *
5 *   it under the terms of the GNU General Public License as published by  *
6 *   the Free Software Foundation; either version 2 of the License, or     *
7 *   (at your option) any later version.                                   *
8 *                                                                         *
9 *   This code is distributed in the hope that it will be useful, but      *
10 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
12 *   General Public License for more details.                              *
13 *                                                                         *
14 *   A copy of the GNU General Public License is available on the World    *
15 *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
16 *   obtain it by writing to the Free Software Foundation,                 *
17 *   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.   *
18 *                                                                         *
19 ***************************************************************************
20}
21unit bitbtnform;
22
23{$mode objfpc}
24{$H+}
25
26interface
27
28uses
29  Classes, Forms, Buttons, StdCtrls, Controls;
30
31type
32   TForm1 = class(TForm)
33   private
34
35   protected
36
37   public
38      button1 : TBitBtn;
39      Label1 : TLabel;
40      GroupBox1 : TGroupBox;
41      Radio1 : TRadioButton;
42      Radio2 : TRadioButton;
43      Radio3 : TRadioButton;
44      Radio4 : TRadioButton;
45      Groupbox2 : TGroupbox;
46      Radio5 : TRadioButton;
47      Radio6 : TRadioButton;
48      Radio7 : TRadioButton;
49      Radio8 : TRadioButton;
50      Label2 : TLabel;
51      constructor Create(AOwner: TComponent); override;
52      procedure button1MouseDown(Sender: TObject; Button: TMouseButton;
53                                 Shift: TShiftState; X, Y: Integer);
54      procedure button1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
55      procedure button1MouseUp(Sender: TObject; Button: TMouseButton;
56                                 Shift: TShiftState; X, Y: Integer);
57      procedure button1Enter(Sender : TObject);
58      procedure FormDestroy(Sender : TObject);
59      procedure Radio1Click(Sender : TObject);
60      procedure Radio2Click(Sender : TObject);
61      procedure Radio3Click(Sender : TObject);
62      procedure Radio4Click(Sender : TObject);
63      procedure Radio5Click(Sender : TObject);
64      procedure Radio6Click(Sender : TObject);
65      procedure Radio7Click(Sender : TObject);
66      procedure Radio8Click(Sender : TObject);
67   end;
68
69var
70   Form1 : TForm1;
71
72implementation
73
74constructor TForm1.Create(AOwner: TComponent);
75begin
76   inherited CreateNew(AOwner, 1);
77   Caption := 'TBitBtn Verify';
78   Width := 335;
79   Height := 170;
80   Left := 200;
81   Top := 200;
82
83   OnDestroy := @FormDestroy;
84
85   button1 := TBitBtn.Create(Self);
86   With button1 do
87   begin
88     OnMouseUp:= @button1MouseUp;
89     OnEnter := @button1Enter;
90     OnMouseDown := @button1MouseDown;
91     OnMouseMove := @button1MouseMove;
92     Parent := Self;
93     width := 120;
94     height := 120;
95     left := 15;
96     top := 15;
97     layout := blGlyphLeft;
98     kind := bkClose;
99     caption := 'Close';
100     Show;
101   end;
102
103   Label1 := TLabel.Create(Self);
104   With Label1 do
105   begin
106     Parent := Self;
107     width := 80;
108     left := 15;
109     top := 150;
110     Caption := 'bkClose';
111     Autosize := True;
112     Show;
113   end;
114
115   Label2 := TLabel.Create(Self);
116   With Label2 do
117   begin
118     Parent := Self;
119     width := 80;
120     left := 150;
121     top := 150;
122     Caption := 'blGlyphLeft';
123     Autosize := True;
124     Show;
125   end;
126
127   GroupBox1 := TGroupbox.Create(Self);
128   with GroupBox1 do
129   begin
130     Parent := Self;
131     width := 80;
132     height := 125;
133     left := 150;
134     top := 15;
135     Caption := 'Kind';
136   end;
137
138   Radio1 := TRadioButton.Create(Self);
139   with Radio1 do
140   begin
141     OnClick := @Radio1Click;
142     Parent := GroupBox1;
143     top := 8;
144     left := 8;
145     caption := 'Close';
146     Checked := True;
147     Height := 15;
148     Width := 60;
149     Show;
150   end;
151
152   Radio2 := TRadioButton.Create(Self);
153   with Radio2 do
154   begin
155     OnClick := @Radio2Click;
156     Parent := GroupBox1;
157     top := 32;
158     left := 8;
159     caption := 'Ok';
160     Checked := False;
161     Height := 15;
162     Width := 50;
163     Show;
164   end;
165
166   Radio3 := TRadioButton.Create(Self);
167   with Radio3 do
168   begin
169     OnClick := @Radio3Click;
170     Parent := GroupBox1;
171     top := 56;
172     left := 8;
173     caption := 'Cancel';
174     Checked := False;
175     Height := 15;
176     Width := 65;
177     Show;
178   end;
179
180   Radio4 := TRadioButton.Create(Self);
181   with Radio4 do
182   begin
183     OnClick := @Radio4Click;
184     Parent := GroupBox1;
185     top := 80;
186     left := 8;
187     caption := 'Help';
188     Checked := False;
189     Height := 15;
190     Width := 55;
191     Show;
192   end;
193
194   GroupBox2 := TGroupbox.Create(Self);
195   with GroupBox2 do
196   begin
197     Parent := Self;
198     width := 80;
199     height := 125;
200     left := 240;
201     top := 15;
202     Caption := 'Layout';
203   end;
204
205   Radio5 := TRadioButton.Create(Self);
206   with Radio5 do
207   begin
208     OnClick := @Radio5Click;
209     Parent := GroupBox2;
210     top := 8;
211     left := 8;
212     caption := 'Left';
213     Checked := True;
214     Height := 15;
215     Width := 60;
216     Show;
217   end;
218
219   Radio6 := TRadioButton.Create(Self);
220   with Radio6 do
221   begin
222     OnClick := @Radio6Click;
223     Parent := GroupBox2;
224     top := 32;
225     left := 8;
226     caption := 'Top';
227     Checked := False;
228     Height := 15;
229     Width := 50;
230     Show;
231   end;
232
233   Radio7 := TRadioButton.Create(Self);
234   with Radio7 do
235   begin
236     OnClick := @Radio7Click;
237     Parent := GroupBox2;
238     top := 56;
239     left := 8;
240     caption := 'Right';
241     Checked := False;
242     Height := 15;
243     Width := 65;
244     Show;
245   end;
246
247   Radio8 := TRadioButton.Create(Self);
248   with Radio8 do
249   begin
250     OnClick := @Radio8Click;
251     Parent := GroupBox2;
252     top := 80;
253     left := 8;
254     caption := 'Bottom';
255     Checked := False;
256     Height := 15;
257     Width := 55;
258     Show;
259   end;
260end;
261
262procedure TForm1.FormDestroy(Sender : TObject);
263begin
264
265end;
266
267procedure TForm1.button1MouseDown(Sender: TObject; Button: TMouseButton;
268                                  Shift: TShiftState; X, Y: Integer);
269begin
270  Label1.Caption := 'Button1.Down';
271end;
272
273procedure TForm1.button1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
274begin
275  Label1.Caption := 'Button1.Move';
276end;
277
278procedure TForm1.button1MouseUp(Sender: TObject; Button: TMouseButton;
279                                 Shift: TShiftState; X, Y: Integer);
280begin
281  Label1.Caption := 'Button1.Up';
282end;
283
284procedure TForm1.button1Enter(Sender : TObject);
285begin
286  //
287end;
288
289procedure TForm1.Radio1Click(Sender : TObject);
290begin
291  button1.Kind := bkClose;
292  Label1.Caption := 'bkClose';
293end;
294
295procedure TForm1.Radio2Click(Sender : TObject);
296begin
297  button1.Kind := bkOk;
298  Label1.Caption := 'bkOk';
299end;
300
301procedure TForm1.Radio3Click(Sender : TObject);
302begin
303  button1.Kind := bkCancel;
304  Label1.Caption := 'bkCancel';
305end;
306
307procedure TForm1.Radio4Click(Sender : TObject);
308begin
309  button1.Kind := bkHelp;
310  Label1.Caption := 'bkHelp';
311end;
312
313procedure TForm1.Radio5Click(Sender : TObject);
314begin
315  button1.Layout := blGlyphLeft;
316  Label2.Caption := 'blGlyphLeft';
317end;
318
319procedure TForm1.Radio6Click(Sender : TObject);
320begin
321  button1.Layout := blGlyphTop;
322  Label2.Caption := 'blGlyphTop';
323end;
324
325procedure TForm1.Radio7Click(Sender : TObject);
326begin
327  button1.Layout := blGlyphRight;
328  Label2.Caption := 'blGlyphRight';
329end;
330
331procedure TForm1.Radio8Click(Sender : TObject);
332begin
333  button1.Layout := blGlyphBottom;
334  Label2.Caption := 'blGlyphBottom';
335end;
336
337end.
338
339