mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 10:50:53 +02:00
Examples: Restructure the checkbox demo.
This commit is contained in:
parent
14c022f422
commit
3bcf9cb043
80
examples/simple/rad/checkbox/checkbox_demo.lpi
Normal file
80
examples/simple/rad/checkbox/checkbox_demo.lpi
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="checkbox_demo"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="checkbox_demo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="checkboxform.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="CheckBoxForm"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="checkbox_demo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
25
examples/simple/rad/checkbox/checkbox_demo.lpr
Normal file
25
examples/simple/rad/checkbox/checkbox_demo.lpr
Normal file
@ -0,0 +1,25 @@
|
||||
program checkbox_demo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, CheckBoxForm
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
231
examples/simple/rad/checkbox/checkboxform.lfm
Normal file
231
examples/simple/rad/checkbox/checkboxform.lfm
Normal file
@ -0,0 +1,231 @@
|
||||
object Form1: TForm1
|
||||
Left = 270
|
||||
Height = 450
|
||||
Top = 131
|
||||
Width = 700
|
||||
Caption = 'CheckBox Demo V.03'
|
||||
ClientHeight = 430
|
||||
ClientWidth = 700
|
||||
Menu = mnuMain
|
||||
LCLVersion = '2.3.0.0'
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 10
|
||||
Height = 19
|
||||
Top = 35
|
||||
Width = 77
|
||||
Caption = 'CheckBox1'
|
||||
OnClick = CheckBox1Click
|
||||
TabOrder = 0
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 220
|
||||
Height = 15
|
||||
Top = 35
|
||||
Width = 59
|
||||
Caption = 'Unchecked'
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 400
|
||||
Height = 80
|
||||
Top = 60
|
||||
Width = 180
|
||||
Alignment = taRightJustify
|
||||
BevelInner = bvLowered
|
||||
BevelWidth = 4
|
||||
Caption = 'Hello world'
|
||||
TabOrder = 1
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 400
|
||||
Height = 25
|
||||
Top = 32
|
||||
Width = 180
|
||||
Caption = 'Toggle checkbox'
|
||||
OnClick = Button2Click
|
||||
TabOrder = 2
|
||||
end
|
||||
object Button11: TSpeedButton
|
||||
Left = 5
|
||||
Height = 22
|
||||
Top = 5
|
||||
Width = 45
|
||||
AllowAllUp = True
|
||||
Glyph.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000064000000640000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000C29A
|
||||
74FFC29973FFC29972FFC19870FFC1976FFFC1966EFFC0956DFFC0956CFFC094
|
||||
6BFFBF946BFFBE936AFFBE936AFFBD926AFFBD936BFFBD936BFF00000000C49B
|
||||
75FFEEEEEEFFEEEEEEFFEEEEEEFFEEEEEEFFEEEEEEFFEEEEEEFFEEEEEEFFEDED
|
||||
EDFFECECECFFEBEBEBFFEAEAEAFFEAEAEAFFE9E9E9FFBD936BFF00000000C69D
|
||||
76FFF0F0F0FFF1F1F1FFF1F1F1FFF1F1F1FFF1F1F1FFF0F0F0FFF0F0F0FFF0F0
|
||||
F0FFEFEFEFFFEDEDEDFFECECECFFEBEBEBFFEAEAEAFFBD936AFF00000000C89E
|
||||
77FFF3F3F3FFF3F3F3FFF4F4F4FFF4F4F4FFF4F4F4FFF4F4F4FFF3F3F3FFF3F3
|
||||
F3FFF1F1F1FFF0F0F0FFEEEEEEFFEDEDEDFFEBEBEBFFBE936AFF00000000CAA0
|
||||
78FFF5F5F5FFF6F6F6FFF7F7F7FFF7F7F7FFF7F7F7FFF6F6F6FFF6F6F6FFF5F5
|
||||
F5FFF3F3F3FFF1F1F1FFF0F0F0FFEEEEEEFFECECECFFBE936BFF00000000CCA1
|
||||
79FFF8F8F8FFF9F9F9FFF9F9F9FFF9F9F9FFF9F9F9FFF9F9F9FFF8F8F8FFF7F7
|
||||
F7FFF5F5F5FFF3F3F3FFF1F1F1FFEFEFEFFFEDEDEDFFBF946CFF00000000CEA3
|
||||
7AFFFAFAFAFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFAFAFAFFF9F9
|
||||
F9FFF7F7F7FFF5F5F5FFF2F2F2FFEFEFEFFFEDEDEDFFC0956CFF00000000CFA4
|
||||
7BFFFBFBFBFFFCFCFCFFFDFDFDFFFDFDFDFFFDFDFDFFFCFCFCFFFBFBFBFFFAFA
|
||||
FAFFF8F8F8FFF6F6F6FFF3F3F3FFF0F0F0FFEDEDEDFFC0966EFF00000000CFA4
|
||||
7CFFFCFCFCFFFDFDFDFFFDFDFDFFFEFEFEFFFEFEFEFFFDFDFDFFFCFCFCFFFBFB
|
||||
FBFFF9F9F9FFF6F6F6FFF3F3F3FFF1F1F1FFEEEEEEFFC1976FFF00000000D0A5
|
||||
7CFFFCFCFCFFFDFDFDFFFEFEFEFFFEFEFEFFFEFEFEFFFDFDFDFFFCFCFCFFFBFB
|
||||
FBFFF9F9F9FFF6F6F6FFF3F3F3FFF1F1F1FFEEEEEEFFC19870FF00000000D0A5
|
||||
7CFFD1A57CFFD1A57CFFD1A57CFFD1A57BFFD1A47AFFD0A379FFCFA379FFCEA2
|
||||
78FFCDA077FFCA9F76FFC89D75FFC69B73FFC49A72FFC29972FF00000000CFA4
|
||||
7CFFD0A57CFFD1A57CFFD1A57CFFD1A57CFFD1A47BFFD0A47BFFCFA37AFFCEA2
|
||||
79FFCCA178FFCB9F77FFC89E76FFC69C75FFC49B74FFC29973FF00000000CEA4
|
||||
7CFFCFA47CFFD0A57DFFD0A57CFFD0A57CFFD0A47BFFCFA47BFFCFA37BFFCDA2
|
||||
7AFFCCA179FFCAA078FFC89E77FFC69D76FFC49B75FFC29A74FF000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000
|
||||
}
|
||||
GroupIndex = 1
|
||||
end
|
||||
object Button12: TSpeedButton
|
||||
Left = 55
|
||||
Height = 22
|
||||
Top = 5
|
||||
Width = 23
|
||||
AllowAllUp = True
|
||||
Caption = '2'
|
||||
GroupIndex = 1
|
||||
end
|
||||
object Button13: TSpeedButton
|
||||
Left = 95
|
||||
Height = 22
|
||||
Top = 5
|
||||
Width = 23
|
||||
AllowAllUp = True
|
||||
Caption = '3'
|
||||
Flat = True
|
||||
GroupIndex = 1
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 220
|
||||
Height = 15
|
||||
Top = 90
|
||||
Width = 87
|
||||
Caption = 'active: unknown'
|
||||
end
|
||||
object RadioButton: TRadioButton
|
||||
Left = 10
|
||||
Height = 19
|
||||
Top = 70
|
||||
Width = 84
|
||||
Caption = 'RadioButton'
|
||||
OnClick = RadioButtonClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object RadioButton2: TRadioButton
|
||||
Left = 10
|
||||
Height = 19
|
||||
Top = 90
|
||||
Width = 90
|
||||
Caption = 'RadioButton2'
|
||||
Checked = True
|
||||
OnClick = RadioButtonClick
|
||||
TabOrder = 5
|
||||
TabStop = True
|
||||
end
|
||||
object RadioButton1: TRadioButton
|
||||
Left = 10
|
||||
Height = 19
|
||||
Top = 110
|
||||
Width = 90
|
||||
Caption = 'RadioButton1'
|
||||
OnClick = RadioButtonClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object RadioGroup: TRadioGroup
|
||||
Left = 10
|
||||
Height = 200
|
||||
Top = 200
|
||||
Width = 150
|
||||
AutoFill = True
|
||||
Caption = 'RadioGroup'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 180
|
||||
ClientWidth = 146
|
||||
ItemIndex = 3
|
||||
Items.Strings = (
|
||||
'No 1'
|
||||
'No 2'
|
||||
'No 3'
|
||||
'No 4'
|
||||
'No 5'
|
||||
'No 6'
|
||||
)
|
||||
OnClick = RadioGroupClick
|
||||
TabOrder = 6
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 220
|
||||
Height = 30
|
||||
Top = 220
|
||||
Width = 280
|
||||
Caption = 'Mystic Radiogroups'
|
||||
OnClick = Button3Click
|
||||
TabOrder = 7
|
||||
end
|
||||
object RadioGroup2: TRadioGroup
|
||||
Left = 220
|
||||
Height = 100
|
||||
Top = 300
|
||||
Width = 300
|
||||
AutoFill = True
|
||||
Caption = 'RadioGroup2'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 80
|
||||
ClientWidth = 296
|
||||
Columns = 3
|
||||
Items.Strings = (
|
||||
'No 1'
|
||||
'No 2'
|
||||
'No 3'
|
||||
'No 4'
|
||||
'No 5'
|
||||
'No 6'
|
||||
)
|
||||
OnClick = RadioGroupClick
|
||||
TabOrder = 8
|
||||
end
|
||||
object ToggleBox: TToggleBox
|
||||
Left = 10
|
||||
Height = 30
|
||||
Top = 150
|
||||
Width = 240
|
||||
Caption = 'ToggleBox'
|
||||
OnClick = ToggleBoxClick
|
||||
TabOrder = 9
|
||||
end
|
||||
object mnuMain: TMainMenu
|
||||
Left = 311
|
||||
Top = 146
|
||||
object itmFile: TMenuItem
|
||||
Caption = 'File'
|
||||
object itmFileQuit: TMenuItem
|
||||
Caption = 'Quit'
|
||||
OnClick = itmFileQuitClick
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
360
examples/simple/rad/checkbox/checkboxform.pas
Normal file
360
examples/simple/rad/checkbox/checkboxform.pas
Normal file
@ -0,0 +1,360 @@
|
||||
unit CheckBoxForm;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, LazLogger,
|
||||
Dialogs, StdCtrls, ExtCtrls, Buttons, Menus;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Button3: TButton;
|
||||
Button2: TButton;
|
||||
CheckBox1: TCheckBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
itmFileQuit: TMenuItem;
|
||||
mnuMain: TMainMenu;
|
||||
itmFile: TMenuItem;
|
||||
Panel1: TPanel;
|
||||
Button11: TSpeedButton;
|
||||
Button12: TSpeedButton;
|
||||
Button13: TSpeedButton;
|
||||
RadioButton: TRadioButton;
|
||||
RadioButton1: TRadioButton;
|
||||
RadioButton2: TRadioButton;
|
||||
RadioGroup: TRadioGroup;
|
||||
RadioGroup2: TRadioGroup;
|
||||
ToggleBox: TToggleBox;
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure Button3Click(Sender: TObject);
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure itmFileQuitClick(Sender: TObject);
|
||||
procedure RadioButtonClick(Sender: TObject);
|
||||
procedure RadioGroupClick(Sender: TObject);
|
||||
procedure ToggleBoxClick(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.CheckBox1Click(Sender: TObject);
|
||||
begin
|
||||
DebugLn('[TForm1.CheckBoxClick]');
|
||||
if Assigned (CheckBox1) and Assigned(Label1) then
|
||||
begin
|
||||
DebugLn (' [checkbox and label assigned]');
|
||||
if CheckBox1.Checked then
|
||||
Label1.Caption := 'checked'
|
||||
else
|
||||
Label1.Caption := 'unchecked';
|
||||
|
||||
if CheckBox1.Checked then
|
||||
CheckBox1.Caption := 'new caption'
|
||||
else
|
||||
CheckBox1.Caption := 'Checkbox 1';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.itmFileQuitClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button2Click(Sender: TObject);
|
||||
begin
|
||||
if Assigned(CheckBox1) then
|
||||
CheckBox1.Checked := not CheckBox1.Checked;
|
||||
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.RadioButtonClick(Sender: TObject);
|
||||
begin
|
||||
Debugln('[TForm1.RadioButtonClick]');
|
||||
if Assigned(Label2) then
|
||||
Label2.Caption := 'active: ' + TRadioButton(Sender).Caption;
|
||||
end;
|
||||
|
||||
procedure TForm1.RadioGroupClick(Sender: TObject);
|
||||
begin
|
||||
Debugln('[TForm1.RadioGroupClick]');
|
||||
end;
|
||||
|
||||
procedure TForm1.ToggleBoxClick(Sender: TObject);
|
||||
begin
|
||||
DebugLn('[TForm1.ToggleBoxClick]');
|
||||
if Assigned(ToggleBox) then
|
||||
begin
|
||||
if ToggleBox.Checked then
|
||||
ToggleBox.Caption := 'Togglebox1'
|
||||
else
|
||||
ToggleBox.Caption := 'does nothing:-(';
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
{ 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 := 400;
|
||||
Top := 60;
|
||||
Width := 180;
|
||||
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 := Self; //Panel1;
|
||||
Button2.Left := Panel1.Left; //5;
|
||||
Button2.Top := Checkbox1.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;
|
||||
BtnGlyph := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
BtnGlyph.LoadFromFile('../../../../images/items/item_form.png');
|
||||
Button11.Glyph.Assign(BtnGlyph);
|
||||
finally
|
||||
BtnGlyph.Free;
|
||||
end;
|
||||
|
||||
// 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);
|
||||
|
@ -1,27 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="12"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
<LRSInOutputDirectory Value="False"/>
|
||||
<CompatibilityMode Value="True"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default"/>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
@ -30,15 +28,15 @@
|
||||
</RequiredPackages>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="checkbox.pp"/>
|
||||
<Filename Value="checkbox_demo.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="CheckBox"/>
|
||||
<UnitName Value="CheckBox_Demo"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="40"/>
|
||||
<CursorPos X="54" Y="51"/>
|
||||
<UsageCount Value="20"/>
|
||||
<TopLine Value="112"/>
|
||||
<CursorPos X="25" Y="137"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="4" Y="242" ID="1"/>
|
||||
<Item0 X="4" Y="241" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -48,6 +46,9 @@
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
/***************************************************************************
|
||||
checkbox.pp
|
||||
-----------
|
||||
checkbox_demo.pp
|
||||
----------------
|
||||
Sample for Lazarus Checkbox.
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
program CheckBox;
|
||||
program CheckBox_Demo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -167,7 +167,7 @@ procedure TForm1.LoadMainMenu;
|
||||
var
|
||||
BtnGlyph: TPortableNetworkGraphic;
|
||||
begin
|
||||
OnDestroy := @FormKill;
|
||||
OnDestroy := @FormKill;
|
||||
|
||||
{ set the height and width }
|
||||
Height := 450;
|
||||
@ -181,7 +181,7 @@ begin
|
||||
CheckBox1.Height :=20;
|
||||
CheckBox1.Width := 200;
|
||||
CheckBox1.OnCLick := @CheckBoxClick;
|
||||
CheckBox1.Show;
|
||||
// CheckBox1.Show;
|
||||
CheckBox1.Caption := 'Checkbox 1';
|
||||
|
||||
{ Create a label which shows the state checked/unchecked of the checkbox}
|
||||
@ -191,35 +191,34 @@ begin
|
||||
label1.left := 220;
|
||||
label1.Height :=20;
|
||||
label1.Width := 100;
|
||||
label1.Show;
|
||||
// label1.Show;
|
||||
label1.Caption := 'unchecked';
|
||||
|
||||
|
||||
{ Sample panel here }
|
||||
Panel1:= TPanel.Create(Self);
|
||||
with Panel1 do begin
|
||||
Parent := Self;
|
||||
Left := 320;
|
||||
Left := 400;
|
||||
Top := 60;
|
||||
Width := 280;
|
||||
Width := 180;
|
||||
Height := 81;
|
||||
Alignment:= taRightJustify;
|
||||
BevelInner:= bvLowered;
|
||||
BevelOuter:= bvRaised;
|
||||
BorderWidth:= 4;
|
||||
BevelWidth:= 4;
|
||||
Show;
|
||||
// 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.Parent := Self; //Panel1;
|
||||
Button2.Left := Panel1.Left; //5;
|
||||
Button2.Top := Checkbox1.Top; //45;
|
||||
Button2.Width := 180;
|
||||
Button2.Height := 20;
|
||||
Button2.Show;
|
||||
// Button2.Show;
|
||||
Button2.Caption := 'Toggle checkbox';
|
||||
Button2.OnClick := @Button2Click;
|
||||
|
||||
@ -231,11 +230,11 @@ begin
|
||||
Button11.Left := 5;
|
||||
Button11.Top := 5;
|
||||
Button11.Width:= 45;
|
||||
Button11.Height:= 55;
|
||||
// Button11.Height:= 55;
|
||||
Button11.Flat:= true;
|
||||
BtnGlyph := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
BtnGlyph.LoadFromFile('../images/items/item_form.png');
|
||||
BtnGlyph.LoadFromFile('../../../../images/items/item_form.png');
|
||||
Button11.Glyph.Assign(BtnGlyph);
|
||||
finally
|
||||
BtnGlyph.Free;
|
||||
@ -243,7 +242,7 @@ begin
|
||||
|
||||
// Button11.Spacing:= -1;
|
||||
// Button11.Margin:= 4;
|
||||
Button11.Visible:= true;
|
||||
// Button11.Visible:= true;
|
||||
|
||||
Button12 := TSpeedButton.Create(Self);
|
||||
Button12.GroupIndex:= 1;
|
||||
@ -252,7 +251,7 @@ begin
|
||||
Button12.Left := 55;
|
||||
Button12.Top := 5;
|
||||
// Button12.Flat:= true;
|
||||
Button12.Visible:= true;
|
||||
// Button12.Visible:= true;
|
||||
|
||||
Button13 := TSpeedButton.Create(Self);
|
||||
Button13.GroupIndex:= 1;
|
||||
@ -262,7 +261,7 @@ begin
|
||||
Button13.Top := 5;
|
||||
Button13.Flat:= true;
|
||||
Button13.AllowAllUp:= true;
|
||||
Button13.Visible:= true;
|
||||
// Button13.Visible:= true;
|
||||
|
||||
|
||||
{ Create a label which shows the caption of the active radiobutton }
|
||||
@ -272,7 +271,7 @@ begin
|
||||
label2.left := 220;
|
||||
label2.Height :=20;
|
||||
label2.Width := 200;
|
||||
label2.Show;
|
||||
// label2.Show;
|
||||
label2.Caption := 'active: unknown';
|
||||
|
||||
{ Create a radio button }
|
||||
@ -284,7 +283,7 @@ begin
|
||||
RadioButton.Width := 200;
|
||||
RadioButton.OnCLick := @RadioButtonClick;
|
||||
RadioButton.Checked := false;
|
||||
RadioButton.Show;
|
||||
// RadioButton.Show;
|
||||
RadioButton.Caption := 'Radio button 1';
|
||||
|
||||
{ Create a 2nd radiobutton }
|
||||
@ -298,7 +297,7 @@ begin
|
||||
Width := 200;
|
||||
OnCLick := @RadioButtonClick;
|
||||
Checked := true;
|
||||
Show;
|
||||
// Show;
|
||||
Caption := 'Radiobutton 2'
|
||||
end;
|
||||
|
||||
@ -313,7 +312,7 @@ begin
|
||||
Width := 200;
|
||||
OnCLick := @RadioButtonClick;
|
||||
Checked := false;
|
||||
Show;
|
||||
// Show;
|
||||
Caption := 'Radiobutton 3'
|
||||
end;
|
||||
|
||||
@ -334,7 +333,7 @@ begin
|
||||
RadioGroup.Items.Add ('No 5');
|
||||
RadioGroup.Items.Add ('No 6');
|
||||
ItemIndex := 3;
|
||||
Show;
|
||||
// Show;
|
||||
Caption := 'Radiogroup';
|
||||
end;
|
||||
|
||||
@ -345,7 +344,7 @@ begin
|
||||
Button3.Top := 220;
|
||||
Button3.Width := 180;
|
||||
Button3.Height := 30;
|
||||
Button3.Show;
|
||||
// Button3.Show;
|
||||
Button3.Caption := 'Mystic Radiogroups';
|
||||
Button3.OnClick := @Button3Click;
|
||||
|
||||
@ -366,7 +365,7 @@ begin
|
||||
Items.Add ('No 5');
|
||||
Items.Add ('No 6');
|
||||
ItemIndex := 1;
|
||||
Show;
|
||||
// Show;
|
||||
Caption := '3 columns';
|
||||
end;
|
||||
|
||||
@ -380,7 +379,7 @@ begin
|
||||
Height :=30;
|
||||
Width := 240;
|
||||
OnCLick := @ToggleBoxClick;
|
||||
Show;
|
||||
// Show;
|
||||
Caption := 'ToggleBox 1'
|
||||
end;
|
||||
|
||||
@ -395,9 +394,6 @@ begin
|
||||
itmFileQuit.Caption := 'Quit';
|
||||
itmFileQuit.OnClick := @mnuQuitClicked;
|
||||
itmFile.Add(itmFileQuit);
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
Loading…
Reference in New Issue
Block a user