summaryrefslogtreecommitdiff
path: root/examples/gui/widgettest/widgettest.pas
blob: 1bc7654e4e1a0da0c91c326b379d2a6cbc87383a (plain)
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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
program WidgetTest;

uses
  SysUtils
  ,Classes
  ,gfxbase
  ,fpgui
  ;

type

  // forward declarations
  TCheckBoxForm = class;
  TRadioButtonForm = class;
  TGroupBoxForm = class;
  TEditForm = class;
  TScrollBarForm = class;
  TScrollBoxForm = class;
  TListBoxForm = class;
  TComboBoxForm = class;
  TGridForm = class;
  TMenuForm = class;
  TPanelForm = class;
  TProgressBarForm = class;

  { TMainForm }

  TMainForm = class(TForm)
  private
    _frmCheckBox: TCheckBoxForm;
    _frmRadioButton: TRadioButtonForm;
    _frmGroupBox: TGroupBoxForm;
    _frmEdit: TEditForm;
    _frmScrollBar: TScrollBarForm;
    _frmScrollBox: TScrollBoxForm;
    _frmListBox: TListBoxForm;
    _frmComboBox: TComboBoxForm;
    _frmGrid: TGridForm;
    _frmMenu: TMenuForm;
    _frmPanel: TPanelForm;
    _frmProgressBar: TProgressBarForm;
  public
    destructor Destroy; override;
  published
    Box: TBoxLayout;
    Title: TLabel;
    CheckboxBtn: TButton;
    RadioButtonBtn: TButton;
    GroupBoxBtn: TButton;
    EditBtn: TButton;
    ScrollBarBtn: TButton;
    ScrollBoxBtn: TButton;
    ListBoxBtn: TButton;
    ComboBoxBtn: TButton;
    GridBtn: TButton;
    MenuBtn: TButton;
    PanelBtn: TButton;
    ProgressBarBtn: TButton;
    StdDialogBtn: TButton;
    Separator: TSeparator;
    ExitBtn: TButton;
    procedure CheckBoxBtnClick(Sender: TObject);
    procedure RadioButtonBtnClick(Sender: TObject);
    procedure GroupBoxBtnClick(Sender: TObject);
    procedure EditBtnClick(Sender: TObject);
    procedure ScrollBarBtnClick(Sender: TObject);
    procedure ScrollBoxBtnClick(Sender: TObject);
    procedure ListBoxBtnClick(Sender: TObject);
    procedure ComboBoxBtnClick(Sender: TObject);
    procedure GridBtnClick(Sender: TObject);
    procedure ExitBtnClick(Sender: TObject);
    procedure StdDialogBtnClick(Sender: TObject);
    procedure MenuBtnClick(Sender: TObject);
    procedure PanelBtnClick(Sender: TObject);
    procedure ProgressBarBtnClick(Sender: TObject);
  end;


  TTestForm = class(TForm)
  end;


  TCheckBoxForm = class(TTestForm)
    Box: TBoxLayout;
    GrayCheckBox, CheckBox1, CheckBox2: TCheckBox;
    procedure GrayCheckBoxClick(Sender: TObject);
  end;


  TRadioButtonForm = class(TTestForm)
    Box, HorzBox, ButtonBox1, ButtonBox2: TBoxLayout;
    GrayCheckBox: TCheckBox;
    Radio1a, Radio1b, Radio2a, Radio2b: TRadioButton;
    procedure GrayCheckBoxClick(Sender: TObject);
  end;


  TGroupBoxForm = class(TTestForm)
    HorzBox, VertBox1, VertBox2: TBoxLayout;
    GroupBox1, GroupBox2: TGroupBox;
    GrayCheckBox: TCheckBox;
    Button: TButton;
    Radio1, Radio2, Radio3, Radio4, Radio5: TRadioButton;
    procedure GrayCheckBoxClick(Sender: TObject);
    procedure ButtonClick(Sender: TObject);
    procedure RadioButtonClick(Sender: TObject);
  end;


  TEditForm = class(TTestForm)
    Grid: TGridLayout;
    VertBox, HorzBox1, HorzBox2: TBoxLayout;
    Label1, Label2, PasswordDisplay: TLabel;
    Edit1, Edit2: TEdit;
    GrayCheckBox1, GrayCheckBox2: TCheckBox;
    Separator: TSeparator;
    procedure GrayCheckBox1Click(Sender: TObject);
    procedure GrayCheckBox2Click(Sender: TObject);
    procedure Edit2Change(Sender: TObject);
  end;


  TScrollBarForm = class(TTestForm)
    VertLayout: TBoxLayout;
    GrayCheckBox: TCheckBox;
    HorzBox: TBoxLayout;
    HorzGrid, VertGrid: TGridLayout;
    VertBar: TSeparator;
    VertLabel, Label1, Label2, Label3, Label4, Label5: TLabel;
    PosLabel1, PosLabel2, PosLabel3, PosLabel4, PosLabel5: TLabel;
    VertScrollBar, ScrollBar1, ScrollBar2, ScrollBar3,
      ScrollBar4, ScrollBar5: TScrollBar;
    procedure GrayCheckBoxClick(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
    procedure ScrollBar2Change(Sender: TObject);
    procedure ScrollBar3Change(Sender: TObject);
    procedure ScrollBar4Change(Sender: TObject);
    procedure ScrollBar5Change(Sender: TObject);
  end;


  TScrollBoxForm = class(TTestForm)
    VertLayout: TBoxLayout;
    Label1: TLabel;
    ScrollBox: TScrollBox;
  end;


  TListBoxForm = class(TTestForm)
    ListBox: TListBox;
  end;


  TComboBoxForm = class(TTestForm)
  published
    VertLayout: TBoxLayout;
    GrayCheckBox: TCheckBox;
    BetaLabel: TLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    procedure GrayCheckBoxClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  end;


  TGridForm = class(TTestForm)
    StringGrid: TStringGrid;
    procedure FormCreate(Sender: TObject);
  end;
  

  TMenuForm = class(TTestForm)
  private
    FLayout: TBoxLayout;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
  published
    BoxLayout: TBoxLayout;
    MainMenu: TMenuBar;
    Title: TLabel;
    p1, p2, p3, p4, p5, p6: TPanel;
    HBox: TBoxLayout;
  end;
  
  
  TPanelForm = class(TTestForm)
  private
    procedure   RadioButtonClick(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
  published
    MainLayout: TBoxLayout;
    StyleGroup: TGroupBox;
    rbPlain, rbLowered, rbRaised: TRadioButton;
    VBox1: TBoxLayout;
    Panel: TPanel;
    Separator: TSeparator;
  end;
  

  TProgressBarForm = class(TTestForm)
  private
    procedure   cbShowPercentClick(Sender: TObject);
    procedure   RadioButtonClick(Sender: TObject);
    procedure   GeneratePercentage(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
  published
    MainLayout: TGridLayout;
    VBox: TBoxLayout;
    PB: TProgressBar;
    cbShowPercent: TCheckBox;
    gbColor: TGroupBox;
    rbBlue: TRadioButton;
    rbRed: TRadioButton;
    rbGreen: TRadioButton;
    Separator: TSeparator;
    btnRandom: TButton;
  end;


{ TMenuForm }

constructor TMenuForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Name := 'MenuForm';
  Text := 'Menu Test';
  
  BoxLayout := TBoxLayout.Create(self);
  BoxLayout.Orientation := Vertical;
  
  MainMenu := TMenuBar.Create(self);
  BoxLayout.InsertChild(MainMenu);
  FLayout := TBoxLayout.Create(self);
  FLayout.Spacing := 0;
  FLayout.BorderSpacing := 6;
  FLayout.HorzAlign := horzLeft;
  MainMenu.InsertChild(FLayout);

{
  MainMenu.AddMenu('File');
  MainMenu.AddMenu('Edit');
  MainMenu.AddMenu('Options');
  MainMenu.AddMenu('Windows');
  MainMenu.AddMenu('Help');
}

  FLayout.InsertChild(TPanel.Create('File', self));
  FLayout.InsertChild(TPanel.Create('Edit', self));

  HBox := TBoxLayout.Create(self);
  HBox.HorzAlign := horzLeft;
  HBox.Spacing := 0;
  BoxLayout.InsertChild(HBox);
  p1 := TPanel.Create('File', self);
  p1.BevelStyle := bsPlain;
  p2 := TPanel.Create('Edit', self);
  p2.BevelStyle := bsPlain;
  p3 := TPanel.Create('Options', self);
  p3.BevelStyle := bsPlain;
  p4 := TPanel.Create('Windows', self);
  p4.BevelStyle := bsPlain;
  p5 := TPanel.Create('Help', self);
  p5.BevelStyle := bsPlain;
//  HBox.InsertChild(p1);
//  HBox.InsertChild(p2);
  HBox.InsertChild(p3);
  HBox.InsertChild(p4);
  HBox.InsertChild(p5);
  HBox.InsertChild(TPanel.Create('Testing', self));


  Title := TLabel.Create(self);
  Title.CanExpandWidth := True;
  Title.Alignment := taCenter;
  Title.Text := 'This is work in progress...';
  Title.FontColor := clBlue;
  BoxLayout.InsertChild(Title);

  Child := BoxLayout;
end;

destructor TMenuForm.Destroy;
begin
  inherited Destroy;
end;

{ TPanelForm }

procedure TPanelForm.RadioButtonClick(Sender: TObject);
begin
  case TRadioButton(Sender).Tag of
    1: Panel.BevelStyle := bsPlain;
    2: Panel.BevelStyle := bsLowered;
    3: Panel.BevelStyle := bsRaised;
  end;
end;

constructor TPanelForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Name := 'PanelForm';
  Text := 'Panel Test';
  BorderWidth := 8;

  MainLayout := TBoxLayout.Create(self);
  MainLayout.Orientation := Vertical;
  
  StyleGroup := TGroupBox.Create('Bevel Style:', self);
  StyleGroup.CanExpandWidth := True;
  MainLayout.InsertChild(StyleGroup);
  
  VBox1 := TBoxLayout.Create(self);
  VBox1.Orientation := Vertical;
  StyleGroup.InsertChild(VBox1);
  
  rbPlain := TRadioButton.Create('Plain', self);
  rbPlain.Tag := 1;
  rbPlain.OnClick := @RadioButtonClick;
  rbLowered := TRadioButton.Create('Lowered', self);
  rbLowered.Tag := 2;
  rbLowered.OnClick := @RadioButtonClick;
  rbRaised := TRadioButton.Create('Raised', self);
  rbRaised.Tag := 3;
  rbRaised.OnClick := @RadioButtonClick;
  rbRaised.Checked := True;
  VBox1.InsertChild(rbPlain);
  VBox1.InsertChild(rbLowered);
  VBox1.InsertChild(rbRaised);
  
  Separator := TSeparator.Create(self);
  MainLayout.InsertChild(Separator);

  Panel := TPanel.Create('My Panel', self);
  MainLayout.InsertChild(Panel);
  
  Child := MainLayout;
end;

destructor TPanelForm.Destroy;
begin
  inherited Destroy;
end;


{ TProgressBarForm }

procedure TProgressBarForm.cbShowPercentClick(Sender: TObject);
begin
  PB.ShowPercentage := cbShowPercent.Checked;
end;

procedure TProgressBarForm.RadioButtonClick(Sender: TObject);
begin
  case TRadioButton(Sender).Tag of
    1: PB.FillColor := clRed;
    2: PB.FillColor := clGreen;
    3: PB.FillColor := clBlue;
  end;
end;

procedure TProgressBarForm.GeneratePercentage(Sender: TObject);
begin
  PB.Position := Random(100);
end;

constructor TProgressBarForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Text := 'Progress Bar Demo';
  BorderWidth := 8;

  MainLayout := TGridLayout.Create(self);
  MainLayout.RowCount := 4;
  MainLayout.ColCount := 2;
  
  VBox := TBoxLayout.Create(self);
  VBox.Orientation := Vertical;
  
  gbColor   := TGroupBox.Create('Fill Color', self);
  rbRed           := TRadioButton.Create('Red', self);
  rbRed.Tag       := 1;
  rbRed.OnClick   := @RadioButtonClick;
  rbRed.Checked   := True;

  rbGreen         := TRadioButton.Create('Green', self);
  rbGreen.Tag     := 2;
  rbGreen.OnClick := @RadioButtonClick;

  rbBlue          := TRadioButton.Create('Blue', self);
  rbBlue.Tag      := 3;
  rbBlue.OnClick  := @RadioButtonClick;

  VBox.InsertChild(rbRed);
  VBox.InsertChild(rbGreen);
  VBox.InsertChild(rbBlue);
  gbColor.InsertChild(VBox);
  MainLayout.AddWidget(gbColor, 0, 0, 1, 2);

  cbShowPercent := TCheckbox.Create('Show Percentage', self);
  cbShowPercent.Checked := True;
  cbShowPercent.OnClick := @cbShowPercentClick;
  cbShowPercent.CanExpandWidth := True;
  MainLayout.AddWidget(cbShowPercent, 1, 0, 1, 1);
  
  btnRandom := TButton.Create('Randomize', self);
  btnRandom.OnClick := @GeneratePercentage;
  MainLayout.AddWidget(btnRandom, 1, 1, 1, 1);

  Separator := TSeparator.Create(self);
  MainLayout.AddWidget(Separator, 0, 2, 2, 1);
  
  PB := TProgressBar.Create('', self);
  PB.Position := 75;
  MainLayout.AddWidget(PB, 0, 3, 2, 1);
  
  Child := MainLayout;
end;

destructor TProgressBarForm.Destroy;
begin
  inherited Destroy;
end;


// -------------------------------------------------------------------
//   TMainForm
// -------------------------------------------------------------------

destructor TMainForm.Destroy;
begin
  _frmCheckBox.Free;
  _frmRadioButton.Free;
  _frmGroupBox.Free;
  _frmEdit.Free;
  _frmScrollBar.Free;
  _frmScrollBox.Free;
  _frmListBox.Free;
  _frmComboBox.Free;
  _frmGrid.Free;
  _frmMenu.Free;
  _frmPanel.Free;
  _frmProgressBar.Free;
  inherited Destroy;
end;


procedure TMainForm.CheckBoxBtnClick(Sender: TObject);
begin
  if Assigned(_frmCheckBox) then
    _frmCheckBox.Show
  else
    Application.CreateForm(TCheckBoxForm, _frmCheckBox);
end;


procedure TMainForm.RadioButtonBtnClick(Sender: TObject);
begin
  if Assigned(_frmRadioButton) then
    _frmRadioButton.Show
  else
    Application.CreateForm(TRadioButtonForm, _frmRadioButton);
end;


procedure TMainForm.GroupBoxBtnClick(Sender: TObject);
begin
  if Assigned(_frmGroupBox) then
    _frmGroupBox.Show
  else
    Application.CreateForm(TGroupBoxForm, _frmGroupBox);
end;


procedure TMainForm.EditBtnClick(Sender: TObject);
begin
  if Assigned(_frmEdit) then
    _frmEdit.Show
  else
    Application.CreateForm(TEditForm, _frmEdit);
end;


procedure TMainForm.ScrollBarBtnClick(Sender: TObject);
begin
  if Assigned(_frmScrollBar) then
    _frmScrollBar.Show
  else
    Application.CreateForm(TScrollBarForm, _frmScrollBar);
end;


procedure TMainForm.ScrollBoxBtnClick(Sender: TObject);
begin
  if Assigned(_frmScrollBox) then
    _frmScrollBox.Show
  else
    Application.CreateForm(TScrollBoxForm, _frmScrollBox);
end;


procedure TMainForm.ListBoxBtnClick(Sender: TObject);
begin
  if Assigned(_frmListBox) then
    _frmListBox.Show
  else
    Application.CreateForm(TListBoxForm, _frmListBox);
end;


procedure TMainForm.ComboBoxBtnClick(Sender: TObject);
begin
  if Assigned(_frmComboBox) then
    _frmComboBox.Show
  else
    Application.CreateForm(TComboBoxForm, _frmComboBox);
end;


procedure TMainForm.GridBtnClick(Sender: TObject);
begin
  if Assigned(_frmGrid) then
    _frmGrid.Show
  else
    Application.CreateForm(TGridForm, _frmGrid);
end;


procedure TMainForm.ExitBtnClick(Sender: TObject);
begin
  Close;
end;


procedure TMainForm.StdDialogBtnClick(Sender: TObject);
var
  dlg: TStandardDialog;
begin
  {$Note This needs to be reworked completely! }
  if Assigned(dlg) then
    dlg.Show
  else
    Application.CreateForm(TStandardDialog, dlg);
//    dlg := TStandardDialog.Create(self);
    
//  dlg.Text := 'This is a single line of text.';
//  dlg.Show;
end;


procedure TMainForm.MenuBtnClick(Sender: TObject);
begin
  if Assigned(_frmMenu) then
    _frmMenu.Show
  else
  begin
    _frmMenu := TMenuForm.Create(self);
//    Application.AddForm(_frmMenu);
    _frmMenu.Show;
  end;
  _frmMenu.SetPosition(Point(Left + Width + 5, FindForm.Top));
end;

procedure TMainForm.PanelBtnClick(Sender: TObject);
begin
  if Assigned(_frmPanel) then
    _frmPanel.Show
  else
  begin
    _frmPanel := TPanelForm.Create(self);
    _frmPanel.Show;
  end;
  _frmPanel.SetPosition(Point(Left + Width + 5, FindForm.Top));
end;

procedure TMainForm.ProgressBarBtnClick(Sender: TObject);
begin
  if Assigned(_frmProgressBar) then
    _frmProgressBar.Show
  else
  begin
    _frmProgressBar := TProgressBarForm.Create(self);
    _frmProgressBar.Show;
  end;
  _frmProgressBar.SetPosition(Point(Left + Width + 5, FindForm.Top));
end;


// -------------------------------------------------------------------
//   TCheckBoxForm
// -------------------------------------------------------------------

procedure TCheckBoxForm.GrayCheckBoxClick(Sender: TObject);
begin
  CheckBox1.Enabled := not GrayCheckBox.Checked;
  CheckBox2.Enabled := not GrayCheckBox.Checked;
end;


// -------------------------------------------------------------------
//   TRadioButtonForm
// -------------------------------------------------------------------

procedure TRadioButtonForm.GrayCheckBoxClick(Sender: TObject);
begin
  HorzBox.Enabled := not GrayCheckBox.Checked;
end;


// -------------------------------------------------------------------
//   TGroupBoxForm
// -------------------------------------------------------------------

procedure TGroupBoxForm.GrayCheckBoxClick(Sender: TObject);
begin
  GroupBox2.Enabled := not GrayCheckBox.Checked;
end;


procedure TGroupBoxForm.ButtonClick(Sender: TObject);
begin
  Radio1.Checked := True;
  Button.Enabled := False;
end;


procedure TGroupBoxForm.RadioButtonClick(Sender: TObject);
begin
  Button.Enabled := not Radio1.Checked;
end;


// -------------------------------------------------------------------
//   TEditForm
// -------------------------------------------------------------------

procedure TEditForm.GrayCheckBox1Click(Sender: TObject);
begin
  Edit1.Enabled := not GrayCheckBox1.Checked;
end;


procedure TEditForm.GrayCheckBox2Click(Sender: TObject);
begin
  Edit2.Enabled := not GrayCheckBox2.Checked;
end;


procedure TEditForm.Edit2Change(Sender: TObject);
begin
  PasswordDisplay.Text := '(= ' + Edit2.Text + ')';
end;


// -------------------------------------------------------------------
//   TScrollBarForm
// -------------------------------------------------------------------

procedure TScrollBarForm.GrayCheckBoxClick(Sender: TObject);
begin
  HorzBox.Enabled := not GrayCheckBox.Checked;
end;


procedure TScrollBarForm.ScrollBar1Change(Sender: TObject);
begin
  PosLabel1.Text := IntToStr(ScrollBar1.Position);
end;


procedure TScrollBarForm.ScrollBar2Change(Sender: TObject);
begin
  PosLabel2.Text := IntToStr(ScrollBar2.Position);
end;


procedure TScrollBarForm.ScrollBar3Change(Sender: TObject);
begin
  PosLabel3.Text := IntToStr(ScrollBar3.Position);
end;


procedure TScrollBarForm.ScrollBar4Change(Sender: TObject);
begin
  PosLabel4.Text := IntToStr(ScrollBar4.Position);
end;


procedure TScrollBarForm.ScrollBar5Change(Sender: TObject);
begin
  PosLabel5.Text := IntToStr(ScrollBar5.Position);
end;


// -------------------------------------------------------------------
//   TComboBoxForm
// -------------------------------------------------------------------

procedure TComboBoxForm.GrayCheckBoxClick(Sender: TObject);
begin
  ComboBox1.Enabled := not GrayCheckBox.Checked;
  ComboBox2.Enabled := not GrayCheckBox.Checked;
end;


procedure TComboBoxForm.FormCreate(Sender: TObject);
var
  i: integer;
begin
  for i := 1 to 20 do
  begin
    ComboBox1.Items.Add(Format('Item 1.%d...', [i]));
    ComboBox2.Items.Add(Format('Item 2.%d...', [i]));
  end;
  BetaLabel.FontColor := clBlue;
end;


// -------------------------------------------------------------------
//   TGridForm
// -------------------------------------------------------------------

procedure TGridForm.FormCreate(Sender: TObject);
var
  x, y: Integer;
begin
  for y := 0 to StringGrid.RowCount - 1 do
    for x := 0 to StringGrid.ColCount - 1 do
      StringGrid.Cells[x, y] := Format('%d, %d', [x, y]);
end;


var
  MainForm: TMainForm;
begin
  MainForm := nil;
  WriteLn('Version: ' + {$I %date%} + ' ' + {$I %time%});

  Application.CreateForm(TMainForm, MainForm);
  try
    Application.Run;
  finally
    MainForm.Free;
  end;
end.