File: bitbtnform.pp

package info (click to toggle)
lazarus 0.9.28.2-12
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 93,096 kB
  • ctags: 89,312
  • sloc: pascal: 820,189; xml: 202,194; makefile: 110,323; sh: 2,460; perl: 395; sql: 174; ansic: 133
file content (338 lines) | stat: -rw-r--r-- 8,050 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
{
 ***************************************************************************
 *                                                                         *
 *   This source is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This code is distributed in the hope that it will be useful, but      *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   A copy of the GNU General Public License is available on the World    *
 *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
 *   obtain it by writing to the Free Software Foundation,                 *
 *   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.        *
 *                                                                         *
 ***************************************************************************
}
unit bitbtnform;

{$mode objfpc}
{$H+}

interface

uses
  Classes, Forms, Buttons, StdCtrls, Controls;

type
   TForm1 = class(TForm)
   private
     { Private Declarations }
   protected
     { Protected Declarations }
   public
      button1 : TBitBtn;
      Label1 : TLabel;
      GroupBox1 : TGroupBox;
      Radio1 : TRadioButton;
      Radio2 : TRadioButton;
      Radio3 : TRadioButton;
      Radio4 : TRadioButton;
      Groupbox2 : TGroupbox;
      Radio5 : TRadioButton;
      Radio6 : TRadioButton;
      Radio7 : TRadioButton;
      Radio8 : TRadioButton;
      Label2 : TLabel;
      constructor Create(AOwner: TComponent); override;
      procedure button1MouseDown(Sender: TObject; Button: TMouseButton;
                                 Shift: TShiftState; X, Y: Integer);
      procedure button1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
      procedure button1MouseUp(Sender: TObject; Button: TMouseButton;
                                 Shift: TShiftState; X, Y: Integer);
      procedure button1Enter(Sender : TObject);
      procedure FormDestroy(Sender : TObject);
      procedure Radio1Click(Sender : TObject);
      procedure Radio2Click(Sender : TObject);
      procedure Radio3Click(Sender : TObject);
      procedure Radio4Click(Sender : TObject);
      procedure Radio5Click(Sender : TObject);
      procedure Radio6Click(Sender : TObject);
      procedure Radio7Click(Sender : TObject);
      procedure Radio8Click(Sender : TObject);
   end;

var
   Form1 : TForm1;

implementation

constructor TForm1.Create(AOwner: TComponent);
begin
   inherited Create(AOwner);
   Caption := 'TBitBtn Verify';
   Width := 335;
   Height := 170;
   Left := 200;
   Top := 200;

   OnDestroy := @FormDestroy;

   button1 := TBitBtn.Create(Self);
   With button1 do
   begin
     OnMouseUp:= @button1MouseUp;
     OnEnter := @button1Enter;
     OnMouseDown := @button1MouseDown;
     OnMouseMove := @button1MouseMove;
     Parent := Self;
     width := 120;
     height := 120;
     left := 15;
     top := 15;
     layout := blGlyphLeft;
     kind := bkClose;
     caption := 'Close';
     Show;
   end;
   
   Label1 := TLabel.Create(Self);
   With Label1 do
   begin
     Parent := Self;
     width := 80;
     left := 15;
     top := 150;
     Caption := 'bkClose';
     Autosize := True;
     Show;
   end;

   Label2 := TLabel.Create(Self);
   With Label2 do
   begin
     Parent := Self;
     width := 80;
     left := 150;
     top := 150;
     Caption := 'blGlyphLeft';
     Autosize := True;
     Show;
   end;
   
   GroupBox1 := TGroupbox.Create(Self);
   with GroupBox1 do
   begin
     Parent := Self;
     width := 80;
     height := 125;
     left := 150;
     top := 15;
     Caption := 'Kind';
   end;

   Radio1 := TRadioButton.Create(Self);
   with Radio1 do
   begin
     OnClick := @Radio1Click;
     Parent := GroupBox1;
     top := 8;
     left := 8;
     caption := 'Close';
     Checked := True;
     Height := 15;
     Width := 60;  
     Show;
   end;

   Radio2 := TRadioButton.Create(Self);
   with Radio2 do
   begin
     OnClick := @Radio2Click;
     Parent := GroupBox1;
     top := 32;
     left := 8;
     caption := 'Ok';
     Checked := False;
     Height := 15;
     Width := 50;
     Show;
   end;

   Radio3 := TRadioButton.Create(Self);
   with Radio3 do
   begin
     OnClick := @Radio3Click;
     Parent := GroupBox1;
     top := 56;
     left := 8;
     caption := 'Cancel';
     Checked := False;
     Height := 15;
     Width := 65;
     Show;
   end;

   Radio4 := TRadioButton.Create(Self);
   with Radio4 do
   begin
     OnClick := @Radio4Click;
     Parent := GroupBox1;
     top := 80;
     left := 8;
     caption := 'Help';
     Checked := False;
     Height := 15;
     Width := 55;
     Show;
   end;

   GroupBox2 := TGroupbox.Create(Self);
   with GroupBox2 do
   begin
     Parent := Self;
     width := 80;
     height := 125;
     left := 240;
     top := 15;
     Caption := 'Layout';
   end;

   Radio5 := TRadioButton.Create(Self);
   with Radio5 do
   begin
     OnClick := @Radio5Click;
     Parent := GroupBox2;
     top := 8;
     left := 8;
     caption := 'Left';
     Checked := True;
     Height := 15;
     Width := 60;  
     Show;
   end;

   Radio6 := TRadioButton.Create(Self);
   with Radio6 do
   begin
     OnClick := @Radio6Click;
     Parent := GroupBox2;
     top := 32;
     left := 8;
     caption := 'Top';
     Checked := False;
     Height := 15;
     Width := 50;
     Show;
   end;

   Radio7 := TRadioButton.Create(Self);
   with Radio7 do
   begin
     OnClick := @Radio7Click;
     Parent := GroupBox2;
     top := 56;
     left := 8;
     caption := 'Right';
     Checked := False;
     Height := 15;
     Width := 65;
     Show;
   end;

   Radio8 := TRadioButton.Create(Self);
   with Radio8 do
   begin
     OnClick := @Radio8Click;
     Parent := GroupBox2;
     top := 80;
     left := 8;
     caption := 'Bottom';
     Checked := False;
     Height := 15;
     Width := 55;
     Show;
   end;
end;

procedure TForm1.FormDestroy(Sender : TObject);
begin

end;

procedure TForm1.button1MouseDown(Sender: TObject; Button: TMouseButton;
                                  Shift: TShiftState; X, Y: Integer);
begin
  Label1.Caption := 'Button1.Down';
end;

procedure TForm1.button1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  Label1.Caption := 'Button1.Move';
end;

procedure TForm1.button1MouseUp(Sender: TObject; Button: TMouseButton;
                                 Shift: TShiftState; X, Y: Integer);
begin
  Label1.Caption := 'Button1.Up';
end;

procedure TForm1.button1Enter(Sender : TObject);
begin
  //
end;

procedure TForm1.Radio1Click(Sender : TObject);
begin
  button1.Kind := bkClose;
  Label1.Caption := 'bkClose';
end;

procedure TForm1.Radio2Click(Sender : TObject);
begin
  button1.Kind := bkOk;
  Label1.Caption := 'bkOk';
end;

procedure TForm1.Radio3Click(Sender : TObject);
begin
  button1.Kind := bkCancel;
  Label1.Caption := 'bkCancel';
end;

procedure TForm1.Radio4Click(Sender : TObject);
begin
  button1.Kind := bkHelp;
  Label1.Caption := 'bkHelp';
end;

procedure TForm1.Radio5Click(Sender : TObject);
begin
  button1.Layout := blGlyphLeft;
  Label2.Caption := 'blGlyphLeft';
end;

procedure TForm1.Radio6Click(Sender : TObject);
begin
  button1.Layout := blGlyphTop;
  Label2.Caption := 'blGlyphTop';
end;

procedure TForm1.Radio7Click(Sender : TObject);
begin
  button1.Layout := blGlyphRight;
  Label2.Caption := 'blGlyphRight';
end;

procedure TForm1.Radio8Click(Sender : TObject);
begin
  button1.Layout := blGlyphBottom;
  Label2.Caption := 'blGlyphBottom';
end;

end.