This file is indexed.

/usr/lib/lazarus/0.9.30.4/examples/checkbox.pp is in lazarus-src-0.9.30.4 0.9.30.4-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
{
 /***************************************************************************
                             checkbox.pp
                             -----------
                        Sample for Lazarus Checkbox.


                   Initial Revision  : Wed Dec 29 23:15:32 CST 1999


 ***************************************************************************/

 ***************************************************************************
 *                                                                         *
 *   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.        *
 *                                                                         *
 ***************************************************************************
}
program CheckBox;

{$mode objfpc}{$H+}

uses
  Interfaces, Classes, Stdctrls, Forms, Buttons, Menus, Comctrls,
  SysUtils, ExtCtrls, GraphType, Graphics, Controls;

type
  TForm1 = class(TFORM)
  public
    Button2: TButton;
    Button3: TButton;
    Button11, Button12, Button13 : TSpeedButton; 
    Panel1: TPanel;
    mnuMain: TMainMenu;
    itmFileQuit: TMenuItem;
    itmFile: TMenuItem;
    CheckBox1 : TCheckBox;
    RadioButton : TRadioButton;
    RadioButton2 : TRadioButton;
    RadioButton3 : TRadioButton;
    RadioGroup   : TRadioGroup;
    RadioGroup2  : TRadioGroup;
    ToggleBox   : TToggleBox;
    label1    : TLabel;   
    label2    : TLabel;
    constructor Create(AOwner: TComponent); override;
    procedure LoadMainMenu;
    Procedure FormKill(Sender : TObject);
    procedure mnuQuitClicked(Sender : TObject);
  protected
    procedure Button1CLick(Sender : TObject);
    procedure Button2CLick(Sender : TObject);
    procedure Button3CLick(Sender : TObject);
    procedure Button4CLick(Sender : TObject);
    procedure CheckBoxClick(Sender : TObject);
    procedure RadioButtonClick(Sender : TObject);
    procedure RadioGroupClick(Sender : TObject);
    procedure ToggleBoxClick(Sender : TObject);
  end;

var
Form1 : TForm1;

constructor TForm1.Create(AOwner: TComponent);  
begin
  inherited Create(AOwner);
  Caption := 'CheckBox Demo V.02';
  LoadMainMenu;
end;

procedure TForm1.Button1Click(Sender : TObject);
Begin
End;

procedure TForm1.Button2Click(Sender : TObject);
Begin
   if assigned (CheckBox1) then
   begin
      CheckBox1.Checked := not CheckBox1.Checked; 
   end;
   Panel1.Caption:= 'Changed';
End;

procedure TForm1.Button3Click(Sender : TObject);
var
   i : integer;
Begin
   if assigned (RadioGroup) then
   begin
      i := RadioGroup.ItemIndex;
      if i < RadioGroup.Items.Count -1 
         then RadioGroup.ItemIndex := i + 1
         else RadioGroup.ItemIndex := 0
   end;
   if assigned (RadioGroup2) then
   begin
      i := RadioGroup2.ItemIndex;
      if i < RadioGroup2.Items.Count -1 
         then RadioGroup2.ItemIndex := i + 1
         else RadioGroup2.ItemIndex := 0
   end;
End;

procedure TForm1.Button4Click(Sender : TObject);
Begin
End;

procedure TForm1.CheckBoxClick(Sender : TObject);
Begin
  WriteLn('[TForm1.CheckBoxClick]');
   if assigned (CheckBox1) and assigned (label1) then begin
      Writeln ('   [checkbox and label assigned]');
      if CheckBox1.Checked
        then label1.Caption := 'checked'
        else label1.Caption := 'unchecked';
// ***SIGSEGV!!!!!!!!!      label1.Repaint; 
      if CheckBox1.Checked
        then CheckBox1.Caption := 'new caption'
        else CheckBox1.Caption := 'Checkbox 1';
   end;
End;

procedure TForm1.RadioButtonClick(Sender : TObject);
begin
   WriteLn('[TForm1.RadioButtonClick]');
   if assigned (label2)
      then label2.Caption := 'active: ' + TRadioButton (Sender).Caption
end;

procedure TForm1.RadioGroupClick(Sender : TObject);
begin
   WriteLn('[TForm1.RadioGroupClick]');
end;

procedure TForm1.ToggleBoxClick(Sender : TObject);
begin
   WriteLn('[TForm1.ToggleBoxClick]');
   if assigned (ToggleBox) then
   begin
      if ToggleBox.checked
         then ToggleBox.Caption := 'Togglebox1'
	 else ToggleBox.Caption := 'does nothing:-(';
// ***SIGSEGV!!!!!!!!!      ToggleBox.RePaint;
   end;
end;

{------------------------------------------------------------------------------}

procedure TForm1.FormKill(Sender : TObject);
Begin

End;

{------------------------------------------------------------------------------}
procedure TForm1.LoadMainMenu;

begin
 OnDestroy := @FormKill;

{    set the height and width }
   Height := 450;
   Width := 700;

   { Create a checkbox }
   CheckBox1 := TCheckBox.Create(Self);
   CheckBox1.Parent := self;
   CheckBox1.top := 35;
   CheckBox1.left := 10;
   CheckBox1.Height :=20;
   CheckBox1.Width := 200;
   CheckBox1.OnCLick := @CheckBoxClick;
   CheckBox1.Show;
   CheckBox1.Caption := 'Checkbox 1';

   { Create a label which shows the state checked/unchecked of the checkbox}
   label1 := TLabel.Create(Self);
   label1.Parent := self;
   label1.top := 35;
   label1.left := 220;
   label1.Height :=20;
   label1.Width := 100;
   label1.Show;
   label1.Caption := 'unchecked';


   { Sample panel here }
   Panel1:= TPanel.Create(Self);
   with Panel1 do begin
     Parent := Self;
     Left := 320;
     Top := 60;
     Width := 280;
     Height := 81;
     Alignment:= taRightJustify;
     BevelInner:= bvLowered;
     BevelOuter:= bvRaised;
     BorderWidth:= 4;
     BevelWidth:= 4;
     Show;
     Caption:= 'Hello world';
   end;     

   { Create a button which toggles the checkbox }
   Button2 := TButton.Create(Self);
   Button2.Parent := Panel1;
   Button2.Left := 5;
   Button2.Top := 45;
   Button2.Width := 180;
   Button2.Height := 20;
   Button2.Show;
   Button2.Caption := 'Toggle checkbox';
   Button2.OnClick := @Button2Click;

   Button11 := TSpeedButton.Create(Self);
   Button11.GroupIndex:= 1;
   Button11.Layout:= blGlyphTop;
//   Button11.Caption:= 'Option 1';
   Button11.Parent := Self;
   Button11.Left := 5;
   Button11.Top := 5;
   Button11.Width:= 45;
   Button11.Height:= 55;
   Button11.Flat:= true;
   Button11.Glyph.LoadFromFile('../images/btn_newform.xpm');
//   Button11.Spacing:= -1;
//   Button11.Margin:= 4;
   Button11.Visible:= true;
   
   Button12 := TSpeedButton.Create(Self);
   Button12.GroupIndex:= 1;
   Button12.Caption:= '2';
   Button12.Parent := Self;
   Button12.Left := 55;
   Button12.Top := 5;
//   Button12.Flat:= true;
   Button12.Visible:= true;

   Button13 := TSpeedButton.Create(Self);
   Button13.GroupIndex:= 1;
   Button13.Caption:= '3';
   Button13.Parent := Self;
   Button13.Left := 95;
   Button13.Top := 5;
   Button13.Flat:= true;
   Button13.AllowAllUp:= true;
   Button13.Visible:= true;
   

   { Create a label which shows the caption of the active radiobutton }
   label2 := TLabel.Create(Self);
   label2.Parent := self;
   label2.top := 90;
   label2.left := 220;
   label2.Height :=20;
   label2.Width := 200;
   label2.Show;
   label2.Caption := 'active: unknown';

   { Create a radio button }
   RadioButton := TRadioButton.Create(Self);
   RadioButton.Parent := self;
   RadioButton.top := 70;
   RadioButton.left := 10;
   RadioButton.Height :=20;
   RadioButton.Width := 200;
   RadioButton.OnCLick := @RadioButtonClick;
   RadioButton.Checked := false;  
   RadioButton.Show;
   RadioButton.Caption := 'Radio button 1';
   
   { Create a 2nd radiobutton }
   RadioButton2 := TRadioButton.Create(Self);
   with RadioButton2 do
   begin
     Parent := self;
     top := 90;
     left := 10;
     Height :=20;
     Width := 200;
     OnCLick := @RadioButtonClick;
     Checked := true; 
     Show;
     Caption := 'Radiobutton 2'
   end;

   { Create a 3rd radiobutton }
   RadioButton3 := TRadioButton.Create(Self);
   with RadioButton3 do
   begin
     Parent := self;
     top := 110;
     left := 10;
     Height :=20;
     Width := 200;
     OnCLick := @RadioButtonClick;
     Checked := false;  
     Show;
     Caption := 'Radiobutton 3'
   end;

   { Create a radiogroup }
   RadioGroup := TRadioGroup.Create(Self);
   with RadioGroup do
   begin
     Parent := self;
     top := 200;
     left := 10;
     Height :=200;
     Width := 150;
     OnCLick := @RadioGroupClick;
     RadioGroup.Items.Add ('No 1');
     RadioGroup.Items.Add ('No 2');
     RadioGroup.Items.Add ('No 3');
     RadioGroup.Items.Add ('No 4');
     RadioGroup.Items.Add ('No 5');
     RadioGroup.Items.Add ('No 6');
     ItemIndex := 3;
     Show;
     Caption := 'Radiogroup';
   end;

   { Create a button which does mystic things with the radiogroup }
   Button3 := TButton.Create(Self);
   Button3.Parent := Self;
   Button3.Left := 220;
   Button3.Top := 220;
   Button3.Width := 180;
   Button3.Height := 30;
   Button3.Show;
   Button3.Caption := 'Mystic Radiogroups';
   Button3.OnClick := @Button3Click;

   { Create a radiogroup }
   RadioGroup2 := TRadioGroup.Create(Self);
   with RadioGroup2 do
   begin
     Parent := self;
     top     := 300;
     left    := 220;
     Height  := 100;
     Width   := 300;
     Columns := 3;
     Items.Add ('No 1');
     Items.Add ('No 2');
     Items.Add ('No 3');
     Items.Add ('No 4');
     Items.Add ('No 5');
     Items.Add ('No 6');
     ItemIndex := 1;
     Show;
     Caption := '3 columns';
   end;

   { Create a togglebox }
   ToggleBox := TToggleBox.Create(Self);
   with ToggleBox do
   begin
     Parent := self;
     top := 150;
     left := 10;
     Height :=30;
     Width := 240;
     OnCLick := @ToggleBoxClick;
     Show;
     Caption := 'ToggleBox 1'
   end;

   mnuMain := TMainMenu.Create(Self);
   Menu := mnuMain;

   itmFile := TMenuItem.Create(Self);
   itmFile.Caption := 'File';
   mnuMain.Items.Add(itmFile);

   itmFileQuit := TMenuItem.Create(Self);
   itmFileQuit.Caption := 'Quit';
   itmFileQuit.OnClick := @mnuQuitClicked;
   itmFile.Add(itmFileQuit);

   

end;

{------------------------------------------------------------------------------}
procedure TForm1.mnuQuitClicked(Sender : TObject);
begin
  Close;
end;
{------------------------------------------------------------------------------}

begin
   Application.Initialize; { calls InitProcedure which starts up GTK }
   Application.CreateForm(TForm1, Form1);
   Application.Run;
end.