mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-05 18:19:28 +01:00
Examples: Restructure ComDialogs example.
This commit is contained in:
parent
3c4deba306
commit
7682cf2f88
@ -1,27 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="12"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<SaveOnlyProjectUnits Value="True"/>
|
<SaveOnlyProjectUnits Value="True"/>
|
||||||
<LRSInOutputDirectory Value="False"/>
|
<LRSInOutputDirectory Value="False"/>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<MainUnit Value="0"/>
|
|
||||||
</General>
|
</General>
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="1">
|
||||||
<Item1 Name="default" Default="True"/>
|
<Item1 Name="default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<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>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<FormatVersion Value="2"/>
|
||||||
<FormatVersion Value="1"/>
|
<Modes Count="1">
|
||||||
</local>
|
<Mode0 Name="default"/>
|
||||||
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="2">
|
<RequiredPackages Count="2">
|
||||||
<Item1>
|
<Item1>
|
||||||
@ -37,7 +35,7 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="EditTest"/>
|
<UnitName Value="EditTest"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<CursorPos X="61" Y="33"/>
|
<CursorPos X="54" Y="17"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="20"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
<Version Value="12"/>
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<Title Value="BitButton_Demo"/>
|
<Title Value="BitButton_Demo"/>
|
||||||
<Scaled Value="True"/>
|
<Scaled Value="True"/>
|
||||||
@ -13,8 +16,8 @@
|
|||||||
<DpiAware Value="True"/>
|
<DpiAware Value="True"/>
|
||||||
</XPManifest>
|
</XPManifest>
|
||||||
</General>
|
</General>
|
||||||
<BuildModes>
|
<BuildModes Count="1">
|
||||||
<Item Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
@ -23,25 +26,25 @@
|
|||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2"/>
|
<FormatVersion Value="2"/>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages>
|
<RequiredPackages Count="1">
|
||||||
<Item>
|
<Item1>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units>
|
<Units Count="2">
|
||||||
<Unit>
|
<Unit0>
|
||||||
<Filename Value="bitbutton_demo.lpr"/>
|
<Filename Value="bitbutton_demo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="BitButton_Demo"/>
|
<UnitName Value="BitButton_Demo"/>
|
||||||
</Unit>
|
</Unit0>
|
||||||
<Unit>
|
<Unit1>
|
||||||
<Filename Value="bitbtnform.pas"/>
|
<Filename Value="bitbtnform.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="BitBtnForm"/>
|
<UnitName Value="BitBtnForm"/>
|
||||||
</Unit>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -63,16 +66,16 @@
|
|||||||
</Linking>
|
</Linking>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions>
|
<Exceptions Count="3">
|
||||||
<Item>
|
<Item1>
|
||||||
<Name Value="EAbort"/>
|
<Name Value="EAbort"/>
|
||||||
</Item>
|
</Item1>
|
||||||
<Item>
|
<Item2>
|
||||||
<Name Value="ECodetoolError"/>
|
<Name Value="ECodetoolError"/>
|
||||||
</Item>
|
</Item2>
|
||||||
<Item>
|
<Item3>
|
||||||
<Name Value="EFOpenError"/>
|
<Name Value="EFOpenError"/>
|
||||||
</Item>
|
</Item3>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
<Version Value="12"/>
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<Title Value="checkbox_demo"/>
|
<Title Value="checkbox_demo"/>
|
||||||
<Scaled Value="True"/>
|
<Scaled Value="True"/>
|
||||||
@ -14,8 +17,8 @@
|
|||||||
</XPManifest>
|
</XPManifest>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<BuildModes>
|
<BuildModes Count="1">
|
||||||
<Item Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
@ -24,24 +27,24 @@
|
|||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2"/>
|
<FormatVersion Value="2"/>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages>
|
<RequiredPackages Count="1">
|
||||||
<Item>
|
<Item1>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units>
|
<Units Count="2">
|
||||||
<Unit>
|
<Unit0>
|
||||||
<Filename Value="checkbox_demo.lpr"/>
|
<Filename Value="checkbox_demo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit>
|
</Unit0>
|
||||||
<Unit>
|
<Unit1>
|
||||||
<Filename Value="checkboxform.pas"/>
|
<Filename Value="checkboxform.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="CheckBoxForm"/>
|
<UnitName Value="CheckBoxForm"/>
|
||||||
</Unit>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -63,16 +66,16 @@
|
|||||||
</Linking>
|
</Linking>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions>
|
<Exceptions Count="3">
|
||||||
<Item>
|
<Item1>
|
||||||
<Name Value="EAbort"/>
|
<Name Value="EAbort"/>
|
||||||
</Item>
|
</Item1>
|
||||||
<Item>
|
<Item2>
|
||||||
<Name Value="ECodetoolError"/>
|
<Name Value="ECodetoolError"/>
|
||||||
</Item>
|
</Item2>
|
||||||
<Item>
|
<Item3>
|
||||||
<Name Value="EFOpenError"/>
|
<Name Value="EFOpenError"/>
|
||||||
</Item>
|
</Item3>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
<Version Value="12"/>
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<Title Value="combobox_demo"/>
|
<Title Value="combobox_demo"/>
|
||||||
<Scaled Value="True"/>
|
<Scaled Value="True"/>
|
||||||
@ -14,8 +17,8 @@
|
|||||||
</XPManifest>
|
</XPManifest>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<BuildModes>
|
<BuildModes Count="1">
|
||||||
<Item Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
@ -24,24 +27,24 @@
|
|||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2"/>
|
<FormatVersion Value="2"/>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages>
|
<RequiredPackages Count="1">
|
||||||
<Item>
|
<Item1>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units>
|
<Units Count="2">
|
||||||
<Unit>
|
<Unit0>
|
||||||
<Filename Value="combobox_demo.lpr"/>
|
<Filename Value="combobox_demo.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit>
|
</Unit0>
|
||||||
<Unit>
|
<Unit1>
|
||||||
<Filename Value="comboboxform.pas"/>
|
<Filename Value="comboboxform.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="ComboBoxForm"/>
|
<UnitName Value="ComboBoxForm"/>
|
||||||
</Unit>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -63,16 +66,16 @@
|
|||||||
</Linking>
|
</Linking>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions>
|
<Exceptions Count="3">
|
||||||
<Item>
|
<Item1>
|
||||||
<Name Value="EAbort"/>
|
<Name Value="EAbort"/>
|
||||||
</Item>
|
</Item1>
|
||||||
<Item>
|
<Item2>
|
||||||
<Name Value="ECodetoolError"/>
|
<Name Value="ECodetoolError"/>
|
||||||
</Item>
|
</Item2>
|
||||||
<Item>
|
<Item3>
|
||||||
<Name Value="EFOpenError"/>
|
<Name Value="EFOpenError"/>
|
||||||
</Item>
|
</Item3>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
|||||||
80
examples/simple/rad/comdialogs/comdialogs_demo.lpi
Normal file
80
examples/simple/rad/comdialogs/comdialogs_demo.lpi
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="12"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<Title Value="comdialogs_demo"/>
|
||||||
|
<Scaled Value="True"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
<UseXPManifest Value="True"/>
|
||||||
|
<XPManifest>
|
||||||
|
<DpiAware Value="True"/>
|
||||||
|
</XPManifest>
|
||||||
|
<Icon Value="0"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="1">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item1>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="2">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="comdialogs_demo.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="dlgform.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="DlgForm"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="comdialogs_demo"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item3>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
||||||
26
examples/simple/rad/comdialogs/comdialogs_demo.lpr
Normal file
26
examples/simple/rad/comdialogs/comdialogs_demo.lpr
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
program comdialogs_demo;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF HASAMIGA}
|
||||||
|
athreads,
|
||||||
|
{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms, DlgForm
|
||||||
|
{ you can add units after this };
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
begin
|
||||||
|
RequireDerivedFormResource:=True;
|
||||||
|
Application.Title:='project1';
|
||||||
|
Application.Scaled:=True;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
||||||
85
examples/simple/rad/comdialogs/dlgform.lfm
Normal file
85
examples/simple/rad/comdialogs/dlgform.lfm
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 200
|
||||||
|
Height = 230
|
||||||
|
Top = 200
|
||||||
|
Width = 400
|
||||||
|
Caption = 'Common Dialogs'
|
||||||
|
ClientHeight = 230
|
||||||
|
ClientWidth = 400
|
||||||
|
Color = clTeal
|
||||||
|
LCLVersion = '2.3.0.0'
|
||||||
|
object dirLabel: TLabel
|
||||||
|
Left = 110
|
||||||
|
Height = 15
|
||||||
|
Top = 40
|
||||||
|
Width = 48
|
||||||
|
Caption = 'Directory'
|
||||||
|
end
|
||||||
|
object fileLabel: TLabel
|
||||||
|
Left = 110
|
||||||
|
Height = 15
|
||||||
|
Top = 80
|
||||||
|
Width = 18
|
||||||
|
Caption = 'File'
|
||||||
|
end
|
||||||
|
object closeButton: TButton
|
||||||
|
Tag = 1
|
||||||
|
Left = 110
|
||||||
|
Height = 25
|
||||||
|
Top = 145
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Close'
|
||||||
|
OnClick = ButtonClick
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object openButton: TButton
|
||||||
|
Tag = 2
|
||||||
|
Left = 10
|
||||||
|
Height = 25
|
||||||
|
Top = 10
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Open'
|
||||||
|
OnClick = ButtonClick
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object saveButton: TButton
|
||||||
|
Tag = 3
|
||||||
|
Left = 10
|
||||||
|
Height = 25
|
||||||
|
Top = 52
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Save'
|
||||||
|
OnClick = ButtonClick
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object fontButton: TButton
|
||||||
|
Tag = 4
|
||||||
|
Left = 10
|
||||||
|
Height = 25
|
||||||
|
Top = 94
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Font'
|
||||||
|
OnClick = ButtonClick
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object colorButton: TButton
|
||||||
|
Tag = 5
|
||||||
|
Left = 10
|
||||||
|
Height = 25
|
||||||
|
Top = 136
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Color'
|
||||||
|
OnClick = ButtonClick
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
object dirButton: TButton
|
||||||
|
Tag = 6
|
||||||
|
Left = 10
|
||||||
|
Height = 25
|
||||||
|
Top = 178
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Directory'
|
||||||
|
OnClick = ButtonClick
|
||||||
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
end
|
||||||
77
examples/simple/rad/comdialogs/dlgform.pas
Normal file
77
examples/simple/rad/comdialogs/dlgform.pas
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
unit DlgForm;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
dirButton: TButton;
|
||||||
|
colorButton: TButton;
|
||||||
|
fontButton: TButton;
|
||||||
|
saveButton: TButton;
|
||||||
|
openButton: TButton;
|
||||||
|
closeButton: TButton;
|
||||||
|
dirLabel: TLabel;
|
||||||
|
fileLabel: TLabel;
|
||||||
|
procedure ButtonClick(Sender: TObject);
|
||||||
|
private
|
||||||
|
|
||||||
|
public
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.ButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
case TButton(Sender).Tag of
|
||||||
|
1 : Close;
|
||||||
|
2 : with TOpenDialog.Create(Self) do
|
||||||
|
begin
|
||||||
|
Filter := '*.pp';
|
||||||
|
Options := Options + [ofAllowMultiSelect];
|
||||||
|
if Execute then fileLabel.Caption := FileName;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
3 : with TSaveDialog.Create(Self) do
|
||||||
|
begin
|
||||||
|
Filename := 'untitled.pp';
|
||||||
|
if Execute then fileLabel.Caption := FileName;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
4 : with TFontDialog.Create(Self) do
|
||||||
|
begin
|
||||||
|
Font.Assign(fontButton.Font);
|
||||||
|
if Execute then fontButton.Font.Assign(Font);
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
5 : with TColorDialog.Create(Self) do
|
||||||
|
begin
|
||||||
|
Color := Self.Color;
|
||||||
|
if Execute then Self.Color := Color;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
6 : with TSelectDirectoryDialog.Create(Self) do
|
||||||
|
begin
|
||||||
|
if Execute then dirLabel.Caption := FileName;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
@ -1,44 +1,52 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="12"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<SaveOnlyProjectUnits Value="True"/>
|
<SaveOnlyProjectUnits Value="True"/>
|
||||||
<LRSInOutputDirectory Value="False"/>
|
<LRSInOutputDirectory Value="False"/>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<MainUnit Value="0"/>
|
|
||||||
</General>
|
</General>
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="1">
|
||||||
<Item1 Name="default" Default="True"/>
|
<Item1 Name="default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<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>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<FormatVersion Value="2"/>
|
||||||
<FormatVersion Value="1"/>
|
<Modes Count="1">
|
||||||
</local>
|
<Mode0 Name="default"/>
|
||||||
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="1">
|
<RequiredPackages Count="1">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="1">
|
<Units Count="2">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="comdialogs.pp"/>
|
<Filename Value="comdialogs_demo.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ComDialogs"/>
|
<UnitName Value="ComDialogs_Demo"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<CursorPos X="35" Y="20"/>
|
||||||
<CursorPos X="15" Y="25"/>
|
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="20"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="dlgform.pp"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="DlgForm"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<TopLine Value="52"/>
|
||||||
|
<CursorPos Y="76"/>
|
||||||
|
<UsageCount Value="20"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
}
|
}
|
||||||
program ComDialogs;
|
program ComDialogs_Demo;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
@ -65,7 +65,6 @@ begin
|
|||||||
Parent := Self;
|
Parent := Self;
|
||||||
SetBounds(110, 40, 280, 35);
|
SetBounds(110, 40, 280, 35);
|
||||||
Caption := 'Directory';
|
Caption := 'Directory';
|
||||||
Show;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fileLabel := TLabel.Create(Self);
|
fileLabel := TLabel.Create(Self);
|
||||||
@ -74,7 +73,6 @@ begin
|
|||||||
Parent := Self;
|
Parent := Self;
|
||||||
SetBounds(110, 80, 280, 35);
|
SetBounds(110, 80, 280, 35);
|
||||||
Caption := 'File';
|
Caption := 'File';
|
||||||
Show;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
closeButton := TButton.Create(Self);
|
closeButton := TButton.Create(Self);
|
||||||
Loading…
Reference in New Issue
Block a user