Skip to content

Commit 8d2931a

Browse files
author
César Cardoso
committed
refacotr/name-units-do-demo
1 parent 84cde61 commit 8d2931a

6 files changed

Lines changed: 55 additions & 25 deletions

Samples/Demo01/C4DValidateComponentsDemo01.dpr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ program C4DValidateComponentsDemo01;
22

33
uses
44
Vcl.Forms,
5-
C4DValidateComponentsDemo01.View.Main in 'Src\View\C4DValidateComponentsDemo01.View.Main.pas' {C4DValidateComponentsDemo01ViewMain},
5+
C4D.ValidateComponents.Demo01.View.Main in 'Src\View\C4D.ValidateComponents.Demo01.View.Main.pas' {C4DValidateComponentsDemo01ViewMain},
66
C4D.Validate.Components.Components in '..\..\Src\C4D.Validate.Components.Components.pas',
77
C4D.Validate.Components.NotEmpty in '..\..\Src\C4D.Validate.Components.NotEmpty.pas',
88
C4D.Validate.Components.Length in '..\..\Src\C4D.Validate.Components.Length.pas',
99
C4D.Validate.Components.MinMaxValue in '..\..\Src\C4D.Validate.Components.MinMaxValue.pas',
1010
C4D.Validate.Components in '..\..\Src\C4D.Validate.Components.pas',
1111
C4D.Validate.Components.FieldDisplay in '..\..\Src\C4D.Validate.Components.FieldDisplay.pas',
12-
C4D.Validate.Components.Helpers in '..\..\Src\C4D.Validate.Components.Helpers.pas';
12+
C4D.Validate.Components.Helpers in '..\..\Src\C4D.Validate.Components.Helpers.pas',
13+
C4D.ValidateComponents.Demo01.Utils in 'Src\Utils\C4D.ValidateComponents.Demo01.Utils.pas';
1314

1415
{$R *.res}
1516

Samples/Demo01/C4DValidateComponentsDemo01.dproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<DelphiCompile Include="$(MainSource)">
9999
<MainSource>MainSource</MainSource>
100100
</DelphiCompile>
101-
<DCCReference Include="Src\View\C4DValidateComponentsDemo01.View.Main.pas">
101+
<DCCReference Include="Src\View\C4D.ValidateComponents.Demo01.View.Main.pas">
102102
<Form>C4DValidateComponentsDemo01ViewMain</Form>
103103
<FormType>dfm</FormType>
104104
</DCCReference>
@@ -109,6 +109,7 @@
109109
<DCCReference Include="..\..\Src\C4D.Validate.Components.pas"/>
110110
<DCCReference Include="..\..\Src\C4D.Validate.Components.FieldDisplay.pas"/>
111111
<DCCReference Include="..\..\Src\C4D.Validate.Components.Helpers.pas"/>
112+
<DCCReference Include="Src\Utils\C4D.ValidateComponents.Demo01.Utils.pas"/>
112113
<BuildConfiguration Include="Release">
113114
<Key>Cfg_2</Key>
114115
<CfgParent>Base</CfgParent>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
unit C4D.ValidateComponents.Demo01.Utils;
2+
3+
interface
4+
5+
uses
6+
System.SysUtils,
7+
System.Classes,
8+
Vcl.Graphics,
9+
Vcl.Controls,
10+
Vcl.Forms,
11+
Vcl.Dialogs,
12+
Vcl.StdCtrls,
13+
Vcl.ExtCtrls,
14+
Vcl.ComCtrls;
15+
16+
type
17+
TUtils = class
18+
public
19+
class procedure ClearAllFieldsForm(const AForm: TForm);
20+
end;
21+
22+
implementation
23+
24+
class procedure TUtils.ClearAllFieldsForm(const AForm: TForm);
25+
var
26+
i: Integer;
27+
LComponent: TComponent;
28+
begin
29+
for i := 0 to Pred(AForm.ComponentCount) do
30+
begin
31+
LComponent := AForm.Components[i];
32+
if(LComponent is TEdit)then
33+
TEdit(LComponent).Clear
34+
else if(LComponent is TComboBox)then
35+
TComboBox(LComponent).ItemIndex := -1
36+
else if(LComponent is TCheckBox)then
37+
TCheckBox(LComponent).Checked := False
38+
else if(LComponent is TRadioGroup)then
39+
TRadioGroup(LComponent).ItemIndex := -1
40+
else if(LComponent is TMemo)then
41+
TMemo(LComponent).Lines.Clear
42+
end;
43+
end;
44+
45+
end.

Samples/Demo01/Src/View/C4DValidateComponentsDemo01.View.Main.dfm renamed to Samples/Demo01/Src/View/C4D.ValidateComponents.Demo01.View.Main.dfm

File renamed without changes.

Samples/Demo01/Src/View/C4DValidateComponentsDemo01.View.Main.pas renamed to Samples/Demo01/Src/View/C4D.ValidateComponents.Demo01.View.Main.pas

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
unit C4DValidateComponentsDemo01.View.Main;
1+
unit C4D.ValidateComponents.Demo01.View.Main;
22

33
interface
44

55
uses
66
Winapi.Windows,
7-
Winapi.Messages,
7+
88
System.SysUtils,
99
System.Variants,
1010
System.Classes,
@@ -15,7 +15,7 @@ interface
1515
Vcl.StdCtrls,
1616
Vcl.ExtCtrls,
1717
Vcl.ComCtrls,
18-
System.RTTI,
18+
C4D.ValidateComponents.Demo01.Utils,
1919
C4D.Validate.Components;
2020

2121
type
@@ -82,24 +82,8 @@ implementation
8282
{$R *.dfm}
8383

8484
procedure TC4DValidateComponentsDemo01ViewMain.btnClearAllFieldsClick(Sender: TObject);
85-
var
86-
i: Integer;
87-
LComponent: TComponent;
8885
begin
89-
for i := 0 to Pred(Self.ComponentCount) do
90-
begin
91-
LComponent := Self.Components[i];
92-
if(LComponent is TEdit)then
93-
TEdit(LComponent).Clear
94-
else if(LComponent is TComboBox)then
95-
TComboBox(LComponent).ItemIndex := -1
96-
else if(LComponent is TCheckBox)then
97-
TCheckBox(LComponent).Checked := False
98-
else if(LComponent is TRadioGroup)then
99-
TRadioGroup(LComponent).ItemIndex := -1
100-
else if(LComponent is TMemo)then
101-
TMemo(LComponent).Lines.Clear
102-
end;
86+
TUtils.ClearAllFieldsForm(Self);
10387
end;
10488

10589
procedure TC4DValidateComponentsDemo01ViewMain.btnValidarClick(Sender: TObject);

Src/C4D.Validate.Components.Helpers.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ interface
44

55
uses
66
System.SysUtils,
7-
System.RTTI,
8-
System.TypInfo;
7+
System.RTTI;
98

109
type
1110
TRttiFieldyHelper = class helper for TRttiField

0 commit comments

Comments
 (0)