RxFPC: add demo for RxIniPropStorageDemo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5357 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2016-11-17 06:32:15 +00:00
parent 8fdb7bbd70
commit cec7326c1c
7 changed files with 404 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="RxIniPropStorage DEMO"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="rxnew"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="project1"/>
</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>

View File

@ -0,0 +1,22 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, rxnew
{ you can add units after this };
{$R *.res}
begin
Application.Title:='RxIniPropStorage DEMO';
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="10"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="21"/>
<CursorPos X="73" Y="55"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
</Units>
<JumpHistory Count="14" HistoryIndex="13">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="16" Column="22"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="17" Column="22"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="18" Column="22"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="19" Column="22"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="20" Column="22"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="40" Column="5" TopLine="6"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="45" Column="5" TopLine="12"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="46" Column="5" TopLine="12"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
<Caret Line="47" Column="5" TopLine="12"/>
</Position9>
<Position10>
<Filename Value="unit1.pas"/>
<Caret Line="46" Column="5" TopLine="12"/>
</Position10>
<Position11>
<Filename Value="unit1.pas"/>
<Caret Line="47" Column="5" TopLine="12"/>
</Position11>
<Position12>
<Filename Value="unit1.pas"/>
<Caret Line="48" Column="5" TopLine="12"/>
</Position12>
<Position13>
<Filename Value="unit1.pas"/>
<Caret Line="49" Column="5" TopLine="12"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
<Caret Line="50" Column="5" TopLine="13"/>
</Position14>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,155 @@
object Form1: TForm1
Left = 676
Height = 330
Top = 298
Width = 632
Caption = 'RxIniPropStorage DEMO'
ClientHeight = 330
ClientWidth = 632
Position = poScreenCenter
SessionProperties = 'Edit1.Text;Edit2.Text'
LCLVersion = '1.7'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrBottom
Left = 6
Height = 20
Top = 32
Width = 48
BorderSpacing.Around = 6
Caption = 'Value 1'
ParentColor = False
end
object Edit1: TEdit
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Label5
Left = 12
Height = 37
Top = 58
Width = 267
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 0
end
object Label2: TLabel
AnchorSideLeft.Control = Label5
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrBottom
Left = 354
Height = 20
Top = 32
Width = 48
BorderSpacing.Around = 6
Caption = 'Value 2'
ParentColor = False
end
object Edit2: TEdit
AnchorSideLeft.Control = Label2
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 360
Height = 37
Top = 58
Width = 266
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 1
end
object Edit3: TEdit
AnchorSideLeft.Control = Label3
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Label6
Left = 12
Height = 37
Top = 207
Width = 259
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 2
end
object SpinEdit1: TSpinEdit
AnchorSideLeft.Control = Label4
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 368
Height = 37
Top = 207
Width = 258
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 3
Value = 1
end
object Label3: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Label6
AnchorSideTop.Side = asrBottom
Left = 6
Height = 20
Top = 181
Width = 96
BorderSpacing.Around = 6
Caption = 'Manual value 1'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = Label6
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label6
AnchorSideTop.Side = asrBottom
Left = 362
Height = 20
Top = 181
Width = 96
BorderSpacing.Around = 6
Caption = 'Manual value 2'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
Left = 285
Height = 20
Top = 6
Width = 63
BorderSpacing.Around = 6
Caption = 'Auto save'
ParentColor = False
end
object Label6: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
AnchorSideTop.Side = asrCenter
Left = 277
Height = 20
Top = 155
Width = 79
Caption = 'Manual save'
ParentColor = False
end
object RxIniPropStorage1: TRxIniPropStorage
StoredValues = <
item
Name = 'STRING_VALUE1'
end
item
Name = 'INT_VALUE2'
end>
OnSavingProperties = RxIniPropStorage1SavingProperties
OnRestoreProperties = RxIniPropStorage1RestoreProperties
SeparateFiles = True
left = 304
top = 96
end
end

View File

@ -0,0 +1,59 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, RxIniPropStorage, Forms, Controls, Graphics,
Dialogs, StdCtrls, Spin;
type
{ TForm1 }
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
RxIniPropStorage1: TRxIniPropStorage;
SpinEdit1: TSpinEdit;
procedure RxIniPropStorage1RestoreProperties(Sender: TObject);
procedure RxIniPropStorage1SavingProperties(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.RxIniPropStorage1RestoreProperties(Sender: TObject);
begin
Edit3.Text:=RxIniPropStorage1.StoredValue['STRING_VALUE1'];
if RxIniPropStorage1.StoredValue['INT_VALUE2'] <> '' then
SpinEdit1.Value:=StrToIntDef(RxIniPropStorage1.StoredValue['INT_VALUE2'], 0);
end;
procedure TForm1.RxIniPropStorage1SavingProperties(Sender: TObject);
begin
RxIniPropStorage1.StoredValue['STRING_VALUE1']:=Edit3.Text;
RxIniPropStorage1.StoredValue['INT_VALUE2']:=IntToStr(SpinEdit1.Value);
end;
end.