Skip to content

Commit 24bd7d1

Browse files
committed
Quick.Config fpc sample updated
1 parent db7a79c commit 24bd7d1

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

samples/delphi/QuickConfig/ConfigToFile/Win64/Debug/config.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
31,
2424
987
2525
],
26-
"LastFilename": "library.txt",
26+
"LastFilename": "niño library.txt",
2727
"WindowPos": {
2828
"PosX": 480,
2929
"PosY": 0
@@ -111,11 +111,11 @@
111111
}
112112
],
113113
"Complex": {
114-
"Id": 24336464,
114+
"Id": 24270928,
115115
"Priority": "msHigh",
116116
"Redundant": false
117117
},
118-
"ModifyDate": "2019-01-26T01:38:10.340Z",
118+
"ModifyDate": "2019-01-30T21:24:21.389Z",
119119
"Title": "a fresh title",
120120
"SessionName": "First Session",
121121
"WorkList": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
object Form1: TForm1
2+
Left = 379
3+
Height = 457
4+
Top = 208
5+
Width = 592
6+
Caption = 'Form1'
7+
ClientHeight = 457
8+
ClientWidth = 592
9+
OnClose = FormClose
10+
OnCreate = FormCreate
11+
LCLVersion = '1.9.0.0'
12+
object btnSaveJson: TButton
13+
Left = 448
14+
Height = 25
15+
Top = 424
16+
Width = 120
17+
Caption = 'Save to Registry'
18+
OnClick = btnSaveJsonClick
19+
TabOrder = 0
20+
end
21+
object btnLoadJson: TButton
22+
Left = 312
23+
Height = 25
24+
Top = 424
25+
Width = 123
26+
Caption = 'Load From Registry'
27+
OnClick = btnLoadJsonClick
28+
TabOrder = 1
29+
end
30+
object meInfo: TMemo
31+
Left = 19
32+
Height = 407
33+
Top = 9
34+
Width = 549
35+
ReadOnly = True
36+
ScrollBars = ssAutoBoth
37+
TabOrder = 2
38+
end
39+
end

samples/fpc/QuickConfig/ConfigToRegistry/umain.pas

+10-3
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,18 @@ procedure TForm1.btnSaveJsonClick(Sender: TObject);
125125
end;
126126

127127
procedure TForm1.btnLoadJsonClick(Sender: TObject);
128+
var
129+
NewConfig : TMyConfig;
128130
begin
129131
meInfo.Lines.Add('Load ConfigJson');
130-
ConfigReg.Load;
131-
meInfo.Lines.Add(ConfigReg.ToJSON);
132-
if TestConfig(ConfigTest,ConfigReg) then meInfo.Lines.Add('Test passed successfully!');
132+
NewConfig := TMyConfig.Create(ConfigReg.Provider.HRoot,ConfigReg.Provider.MainKey);
133+
try
134+
NewConfig.Load;
135+
meInfo.Lines.Add(NewConfig.ToJSON);
136+
if TestConfig(ConfigTest,NewConfig) then meInfo.Lines.Add('Test passed successfully!');
137+
finally
138+
NewConfig.Free;
139+
end;
133140
end;
134141

135142
function TForm1.TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean;

0 commit comments

Comments
 (0)