├── .gitignore
├── GenericCollections
├── A. Before Generics
│ ├── ABeforeGenerics.dpr
│ ├── ABeforeGenerics.dproj
│ ├── ABeforeGenerics.res
│ ├── Unit1.dfm
│ └── Unit1.pas
├── B. After Generics
│ ├── BAfterGenerics.dpr
│ ├── BAfterGenerics.dproj
│ ├── BAfterGenerics.res
│ ├── Unit1.dfm
│ └── Unit1.pas
├── C. Sorting
│ ├── CSorting.dpr
│ ├── CSorting.dproj
│ ├── CSorting.res
│ ├── Unit1.dfm
│ └── Unit1.pas
├── D. Sorting Revisited
│ ├── DSortingRevisited.dpr
│ ├── DSortingRevisited.dproj
│ ├── DSortingRevisited.res
│ ├── Unit1.dfm
│ └── Unit1.pas
├── E. Search
│ ├── ESearch.dpr
│ ├── ESearch.dproj
│ ├── ESearch.res
│ ├── Unit1.dfm
│ └── Unit1.pas
├── F. Dictionary
│ ├── FAussieDictionary.dpr
│ ├── FAussieDictionary.dproj
│ ├── FAussieDictionary.res
│ ├── Unit1.dfm
│ └── Unit1.pas
└── GenericCollectionsSamples.groupproj
├── LiveBindings
├── Custom Generator
│ ├── CustomGeneratorsGroup.groupproj
│ ├── EmailGenerator.pas
│ ├── MGCustomGenerator.dpk
│ ├── MGCustomGenerator.dproj
│ ├── Project3.dpr
│ ├── Project3.dproj
│ ├── Unit4.fmx
│ └── Unit4.pas
├── Formatting your Fields
│ ├── CurrencyToStrMethod.pas
│ ├── MGCustomLiveBindingMethods.dpk
│ ├── MGCustomLiveBindingMethods.dproj
│ ├── MethodUtils.pas
│ ├── Project4.dpr
│ ├── Project4.dproj
│ ├── ProjectGroup1.groupproj
│ ├── Unit5.fmx
│ ├── Unit5.pas
│ └── Unit5.vlb
├── Treating an Integer as a Boolean
│ ├── IntToBool.dpr
│ ├── IntToBool.dproj
│ ├── Unit13.fmx
│ ├── Unit13.pas
│ └── Unit13.vlb
└── Updating objects through an Adapter
│ ├── UpdatingObjectsThroughAnAdapter.dpr
│ ├── UpdatingObjectsThroughAnAdapter.dproj
│ ├── UpdatingObjectsThroughAnAdapter.res
│ ├── fMain.fmx
│ ├── fMain.pas
│ └── fMain.vlb
├── OpenDocument
├── OpenDocument.deployproj
├── OpenDocument.dpr
├── OpenDocument.dproj
├── OpenDocument.res
├── fMain.fmx
└── fMain.pas
├── README.markdown
└── SpecialFolders
├── DocumentDirectory.dpr
├── DocumentDirectory.dproj
├── DocumentDirectory.res
├── fMain.fmx
└── fMain.pas
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled source #
2 | ###################
3 | *.dcu
4 | *.obj
5 | *.exe
6 | *.ico
7 | *.rsm
8 | *.plist
9 | *.icns
10 |
11 | # Backup files #
12 | ###################
13 | *.~*
14 |
15 | # IDE Files #
16 | ###################
17 | *.dproj.local
18 | *.groupproj.local
19 | *.identcache
20 | *.dsk
21 | *.tvsconfig
22 | *.txaPackage
23 |
24 | # Output Folders #
25 | ###################
26 | /OSX32
27 | /Win32
28 | /Win64
29 | /Debug
30 |
31 |
32 | # svn #
33 | ###################
34 | /.svn
35 | *.svn-base
36 | all-wcprops
37 | entries
38 |
39 |
40 |
41 | OpenDocument/OSX32/Debug/OpenDocument
42 |
--------------------------------------------------------------------------------
/GenericCollections/A. Before Generics/ABeforeGenerics.dpr:
--------------------------------------------------------------------------------
1 | program ABeforeGenerics;
2 |
3 | uses
4 | Forms,
5 | Unit1 in 'Unit1.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | ReportMemoryLeaksOnShutdown := True;
11 | Application.Initialize;
12 | Application.MainFormOnTaskbar := True;
13 | Application.CreateForm(TForm1, Form1);
14 | Application.Run;
15 | end.
16 |
--------------------------------------------------------------------------------
/GenericCollections/A. Before Generics/ABeforeGenerics.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {7EDE705A-930F-4ACB-B086-70D2202ECBA1}
4 | ABeforeGenerics.dpr
5 | 13.4
6 | True
7 | Debug
8 | Application
9 | VCL
10 | DCC32
11 | Win32
12 | 1
13 |
14 |
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | true
24 | Base
25 | true
26 |
27 |
28 | true
29 | Base
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | 1033
39 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
40 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
41 | 00400000
42 | .\$(Config)\$(Platform)
43 | .\$(Config)\$(Platform)
44 | false
45 | false
46 | false
47 | false
48 | false
49 |
50 |
51 | ABeforeGenerics_Icon.ico
52 | $(BDS)\bin\default_app.manifest
53 |
54 |
55 | true
56 | ABeforeGenerics_Icon.ico
57 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
58 | 1033
59 | $(BDS)\bin\default_app.manifest
60 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
61 |
62 |
63 | DEBUG;$(DCC_Define)
64 | false
65 | true
66 |
67 |
68 | false
69 | RELEASE;$(DCC_Define)
70 | 0
71 | false
72 |
73 |
74 |
75 | MainSource
76 |
77 |
78 |
79 |
80 |
81 | Cfg_2
82 | Base
83 |
84 |
85 | Base
86 |
87 |
88 | Cfg_1
89 | Base
90 |
91 |
92 |
93 |
94 | Delphi.Personality.12
95 |
96 |
97 |
98 |
99 | False
100 | False
101 | 1
102 | 0
103 | 0
104 | 0
105 | False
106 | False
107 | False
108 | False
109 | False
110 | 1033
111 | 1252
112 |
113 |
114 |
115 |
116 | 1.0.0.0
117 |
118 |
119 |
120 |
121 |
122 | 1.0.0.0
123 |
124 |
125 |
126 | ABeforeGenerics.dpr
127 |
128 |
129 |
130 | False
131 | True
132 |
133 |
134 | 12
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/GenericCollections/A. Before Generics/ABeforeGenerics.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/GenericCollections/A. Before Generics/ABeforeGenerics.res
--------------------------------------------------------------------------------
/GenericCollections/A. Before Generics/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 290
6 | ClientWidth = 315
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | OnDestroy = FormDestroy
16 | DesignSize = (
17 | 315
18 | 290)
19 | PixelsPerInch = 96
20 | TextHeight = 13
21 | object Button1: TButton
22 | Left = 8
23 | Top = 8
24 | Width = 75
25 | Height = 25
26 | Caption = 'List People'
27 | TabOrder = 0
28 | OnClick = Button1Click
29 | end
30 | object ListBox1: TListBox
31 | Left = 8
32 | Top = 39
33 | Width = 299
34 | Height = 243
35 | Anchors = [akLeft, akTop, akRight, akBottom]
36 | ItemHeight = 13
37 | TabOrder = 1
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/GenericCollections/A. Before Generics/Unit1.pas:
--------------------------------------------------------------------------------
1 | unit Unit1;
2 |
3 | interface
4 |
5 | uses
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 | Dialogs, contnrs, StdCtrls;
8 |
9 | type
10 | TPerson = class
11 | private
12 | FFirstname: string;
13 | FLastname: string;
14 | FAge: Integer;
15 | public
16 | function ToString: string; override;
17 | property Firstname: string read FFirstname write FFirstname;
18 | property Lastname: string read FLastname write FLastname;
19 | property Age: Integer read FAge write FAge;
20 | constructor Create(const Firstname, Lastname : string; Age : Integer); virtual;
21 |
22 | end;
23 |
24 | TForm1 = class(TForm)
25 | Button1: TButton;
26 | ListBox1: TListBox;
27 | procedure FormCreate(Sender: TObject);
28 | procedure FormDestroy(Sender: TObject);
29 | procedure Button1Click(Sender: TObject);
30 | private
31 | { Private declarations }
32 | FPersonList : TList;
33 | public
34 | { Public declarations }
35 | end;
36 |
37 | var
38 | Form1: TForm1;
39 |
40 | implementation
41 |
42 | {$R *.dfm}
43 |
44 | procedure TForm1.Button1Click(Sender: TObject);
45 | var
46 | i: Integer;
47 | begin
48 | ListBox1.Clear;
49 |
50 | for i := 0 to FPersonList.Count - 1 do
51 | if FPersonList.Items[i] <> nil then
52 | if TObject(FPersonList.Items[i]) is TPerson then
53 | ListBox1.Items.Add(TPerson(FPersonList.Items[i]).ToString);
54 | end;
55 |
56 | procedure TForm1.FormCreate(Sender: TObject);
57 | begin
58 | FPersonList := TList.Create;
59 |
60 | FPersonList.Add(TPerson.Create('Fred', 'Flintstone', 40));
61 | FPersonList.Add(TPerson.Create('Wilma', 'Flintstone', 38));
62 | FPersonList.Add(TPerson.Create('Pebbles', 'Flintstone', 1));
63 | FPersonList.Add(TPerson.Create('Barney', 'Rubble', 38));
64 | FPersonList.Add(TPerson.Create('Betty', 'Rubble', 40));
65 | FPersonList.Add(TPerson.Create('Bam Bam', 'Rubble', 2));
66 | end;
67 |
68 |
69 | procedure TForm1.FormDestroy(Sender: TObject);
70 | var
71 | i: Integer;
72 | begin
73 | for i := FPersonList.Count - 1 downto 0 do
74 | if FPersonList.Items[i] <> nil then
75 | begin
76 | TObject(FPersonList.Items[i]).Free;
77 | FPersonList.Delete(i);
78 | end;
79 | FPersonList.Free;
80 | end;
81 |
82 | { TPerson }
83 |
84 | constructor TPerson.Create(const Firstname, Lastname : string; Age : Integer);
85 | begin
86 | self.Lastname := Lastname;
87 | self.Firstname := Firstname;
88 | self.Age := Age;
89 | end;
90 |
91 | function TPerson.ToString: string;
92 | begin
93 | Result := Format('%s %s : Age %d', [Firstname, Lastname, Age]);
94 | end;
95 |
96 |
97 | end.
98 |
--------------------------------------------------------------------------------
/GenericCollections/B. After Generics/BAfterGenerics.dpr:
--------------------------------------------------------------------------------
1 | program BAfterGenerics;
2 |
3 | uses
4 | Forms,
5 | Unit1 in 'Unit1.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.MainFormOnTaskbar := True;
12 | Application.CreateForm(TForm1, Form1);
13 | Application.Run;
14 | end.
15 |
--------------------------------------------------------------------------------
/GenericCollections/B. After Generics/BAfterGenerics.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {7EDE705A-930F-4ACB-B086-70D2202ECBA1}
4 | BAfterGenerics.dpr
5 | 13.4
6 | True
7 | Debug
8 | Application
9 | VCL
10 | DCC32
11 | Win32
12 | 1
13 |
14 |
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | true
24 | Base
25 | true
26 |
27 |
28 | true
29 | Base
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | 1033
39 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
40 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
41 | 00400000
42 | .\$(Config)\$(Platform)
43 | .\$(Config)\$(Platform)
44 | false
45 | false
46 | false
47 | false
48 | false
49 |
50 |
51 | BAfterGenerics_Icon.ico
52 | $(BDS)\bin\default_app.manifest
53 |
54 |
55 | true
56 | BAfterGenerics_Icon.ico
57 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
58 | 1033
59 | $(BDS)\bin\default_app.manifest
60 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
61 |
62 |
63 | DEBUG;$(DCC_Define)
64 | false
65 | true
66 |
67 |
68 | false
69 | RELEASE;$(DCC_Define)
70 | 0
71 | false
72 |
73 |
74 |
75 | MainSource
76 |
77 |
78 |
79 |
80 |
81 | Cfg_2
82 | Base
83 |
84 |
85 | Base
86 |
87 |
88 | Cfg_1
89 | Base
90 |
91 |
92 |
93 |
94 | Delphi.Personality.12
95 |
96 |
97 |
98 |
99 | False
100 | False
101 | 1
102 | 0
103 | 0
104 | 0
105 | False
106 | False
107 | False
108 | False
109 | False
110 | 1033
111 | 1252
112 |
113 |
114 |
115 |
116 | 1.0.0.0
117 |
118 |
119 |
120 |
121 |
122 | 1.0.0.0
123 |
124 |
125 |
126 | BAfterGenerics.dpr
127 |
128 |
129 |
130 | False
131 | True
132 |
133 |
134 | 12
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/GenericCollections/B. After Generics/BAfterGenerics.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/GenericCollections/B. After Generics/BAfterGenerics.res
--------------------------------------------------------------------------------
/GenericCollections/B. After Generics/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 290
6 | ClientWidth = 315
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | OnDestroy = FormDestroy
16 | DesignSize = (
17 | 315
18 | 290)
19 | PixelsPerInch = 96
20 | TextHeight = 13
21 | object Button1: TButton
22 | Left = 8
23 | Top = 8
24 | Width = 75
25 | Height = 25
26 | Caption = 'List People'
27 | TabOrder = 0
28 | OnClick = Button1Click
29 | end
30 | object ListBox1: TListBox
31 | Left = 8
32 | Top = 39
33 | Width = 299
34 | Height = 243
35 | Anchors = [akLeft, akTop, akRight, akBottom]
36 | ItemHeight = 13
37 | TabOrder = 1
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/GenericCollections/B. After Generics/Unit1.pas:
--------------------------------------------------------------------------------
1 | unit Unit1;
2 |
3 | interface
4 |
5 | uses
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 | Dialogs, Generics.Collections, StdCtrls;
8 |
9 | type
10 | TPerson = class
11 | private
12 | FFirstname: string;
13 | FLastname: string;
14 | FAge: Integer;
15 | public
16 | function ToString: string; override;
17 | property Firstname: string read FFirstname write FFirstname;
18 | property Lastname: string read FLastname write FLastname;
19 | property Age: Integer read FAge write FAge;
20 | constructor Create(const Firstname, Lastname : string; Age : Integer); virtual;
21 |
22 | end;
23 |
24 | TForm1 = class(TForm)
25 | Button1: TButton;
26 | ListBox1: TListBox;
27 | procedure FormCreate(Sender: TObject);
28 | procedure FormDestroy(Sender: TObject);
29 | procedure Button1Click(Sender: TObject);
30 | private
31 | { Private declarations }
32 | FPersonList : TObjectList;
33 | public
34 | { Public declarations }
35 | end;
36 |
37 | var
38 | Form1: TForm1;
39 |
40 | implementation
41 |
42 | {$R *.dfm}
43 |
44 | procedure TForm1.Button1Click(Sender: TObject);
45 | var
46 | Person: TPerson;
47 | begin
48 | ListBox1.Clear;
49 |
50 | for Person in FPersonList do
51 | ListBox1.Items.Add(Person.ToString);
52 | end;
53 |
54 | procedure TForm1.FormCreate(Sender: TObject);
55 | begin
56 | FPersonList := TObjectList.Create(True);
57 |
58 | FPersonList.Add(TPerson.Create('Fred', 'Flintstone', 40));
59 | FPersonList.Add(TPerson.Create('Wilma', 'Flintstone', 38));
60 | FPersonList.Add(TPerson.Create('Pebbles', 'Flintstone', 1));
61 | FPersonList.Add(TPerson.Create('Barney', 'Rubble', 38));
62 | FPersonList.Add(TPerson.Create('Betty', 'Rubble', 40));
63 | FPersonList.Add(TPerson.Create('Bam Bam', 'Rubble', 2));
64 | end;
65 |
66 |
67 | procedure TForm1.FormDestroy(Sender: TObject);
68 | begin
69 | FPersonList.Free;
70 | end;
71 |
72 | { TPerson }
73 |
74 | constructor TPerson.Create(const Firstname, Lastname : string; Age : Integer);
75 | begin
76 | self.Lastname := Lastname;
77 | self.Firstname := Firstname;
78 | self.Age := Age;
79 | end;
80 |
81 | function TPerson.ToString: string;
82 | begin
83 | Result := Format('%s %s : Age %d', [Firstname, Lastname, Age]);
84 | end;
85 |
86 |
87 | end.
88 |
--------------------------------------------------------------------------------
/GenericCollections/C. Sorting/CSorting.dpr:
--------------------------------------------------------------------------------
1 | program CSorting;
2 |
3 | uses
4 | Forms,
5 | Unit1 in 'Unit1.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.MainFormOnTaskbar := True;
12 | Application.CreateForm(TForm1, Form1);
13 | Application.Run;
14 | end.
15 |
--------------------------------------------------------------------------------
/GenericCollections/C. Sorting/CSorting.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {7EDE705A-930F-4ACB-B086-70D2202ECBA1}
4 | CSorting.dpr
5 | 13.4
6 | True
7 | Debug
8 | Application
9 | VCL
10 | DCC32
11 | Win32
12 | 1
13 |
14 |
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | true
24 | Base
25 | true
26 |
27 |
28 | true
29 | Base
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | 1033
39 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
40 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
41 | 00400000
42 | .\$(Config)\$(Platform)
43 | .\$(Config)\$(Platform)
44 | false
45 | false
46 | false
47 | false
48 | false
49 |
50 |
51 | CSorting_Icon.ico
52 |
53 |
54 | true
55 | CSorting_Icon.ico
56 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
57 | 1033
58 | $(BDS)\bin\default_app.manifest
59 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
60 |
61 |
62 | DEBUG;$(DCC_Define)
63 | false
64 | true
65 |
66 |
67 | false
68 | RELEASE;$(DCC_Define)
69 | 0
70 | false
71 |
72 |
73 |
74 | MainSource
75 |
76 |
77 |
78 |
79 |
80 | Cfg_2
81 | Base
82 |
83 |
84 | Base
85 |
86 |
87 | Cfg_1
88 | Base
89 |
90 |
91 |
92 |
93 | Delphi.Personality.12
94 |
95 |
96 |
97 |
98 | False
99 | False
100 | 1
101 | 0
102 | 0
103 | 0
104 | False
105 | False
106 | False
107 | False
108 | False
109 | 1033
110 | 1252
111 |
112 |
113 |
114 |
115 | 1.0.0.0
116 |
117 |
118 |
119 |
120 |
121 | 1.0.0.0
122 |
123 |
124 |
125 | CSorting.dpr
126 |
127 |
128 |
129 | False
130 | True
131 |
132 |
133 | 12
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/GenericCollections/C. Sorting/CSorting.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/GenericCollections/C. Sorting/CSorting.res
--------------------------------------------------------------------------------
/GenericCollections/C. Sorting/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 290
6 | ClientWidth = 315
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | OnDestroy = FormDestroy
16 | DesignSize = (
17 | 315
18 | 290)
19 | PixelsPerInch = 96
20 | TextHeight = 13
21 | object Button1: TButton
22 | Left = 8
23 | Top = 8
24 | Width = 75
25 | Height = 25
26 | Caption = 'List People'
27 | TabOrder = 0
28 | OnClick = Button1Click
29 | end
30 | object ListBox1: TListBox
31 | Left = 8
32 | Top = 39
33 | Width = 299
34 | Height = 243
35 | Anchors = [akLeft, akTop, akRight, akBottom]
36 | ItemHeight = 13
37 | TabOrder = 1
38 | end
39 | object Button2: TButton
40 | Left = 89
41 | Top = 8
42 | Width = 75
43 | Height = 25
44 | Caption = 'Sort'
45 | TabOrder = 2
46 | OnClick = Button2Click
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/GenericCollections/C. Sorting/Unit1.pas:
--------------------------------------------------------------------------------
1 | unit Unit1;
2 |
3 | interface
4 |
5 | uses
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 | Dialogs, Generics.Collections, StdCtrls, Generics.Defaults;
8 |
9 | type
10 | TPerson = class
11 | private
12 | FFirstname: string;
13 | FLastname: string;
14 | FAge: Integer;
15 | public
16 | function ToString: string; override;
17 | property Firstname: string read FFirstname write FFirstname;
18 | property Lastname: string read FLastname write FLastname;
19 | property Age: Integer read FAge write FAge;
20 | constructor Create(const Firstname, Lastname : string; Age : Integer); virtual;
21 | end;
22 |
23 | TPersonComparer = class(TInterfacedObject, IComparer)
24 | public
25 | function Compare(const Left, Right: TPerson): Integer;
26 | end;
27 |
28 | TForm1 = class(TForm)
29 | Button1: TButton;
30 | ListBox1: TListBox;
31 | Button2: TButton;
32 | procedure FormCreate(Sender: TObject);
33 | procedure FormDestroy(Sender: TObject);
34 | procedure Button1Click(Sender: TObject);
35 | procedure Button2Click(Sender: TObject);
36 | private
37 | { Private declarations }
38 | FPersonList : TObjectList;
39 | procedure LoadListbox;
40 | public
41 | { Public declarations }
42 | end;
43 |
44 | var
45 | Form1: TForm1;
46 |
47 | implementation
48 |
49 | {$R *.dfm}
50 |
51 | procedure TForm1.Button1Click(Sender: TObject);
52 | begin
53 | LoadListbox;
54 | end;
55 |
56 | procedure TForm1.Button2Click(Sender: TObject);
57 | begin
58 | FPersonList.Sort(TPersonComparer.Create);
59 |
60 | LoadListbox;
61 | end;
62 |
63 | procedure TForm1.LoadListbox;
64 | var
65 | Person: TPerson;
66 | begin
67 | ListBox1.Clear;
68 | for Person in FPersonList do
69 | ListBox1.Items.Add(Person.ToString);
70 | end;
71 |
72 | procedure TForm1.FormCreate(Sender: TObject);
73 | begin
74 | FPersonList := TObjectList.Create(True);
75 |
76 | FPersonList.Add(TPerson.Create('Fred', 'Flintstone', 40));
77 | FPersonList.Add(TPerson.Create('Wilma', 'Flintstone', 38));
78 | FPersonList.Add(TPerson.Create('Pebbles', 'Flintstone', 1));
79 | FPersonList.Add(TPerson.Create('Barney', 'Rubble', 38));
80 | FPersonList.Add(TPerson.Create('Betty', 'Rubble', 40));
81 | FPersonList.Add(TPerson.Create('Bam Bam', 'Rubble', 2));
82 | end;
83 |
84 |
85 | procedure TForm1.FormDestroy(Sender: TObject);
86 | begin
87 | FPersonList.Free;
88 | end;
89 |
90 | { TPerson }
91 |
92 | constructor TPerson.Create(const Firstname, Lastname : string; Age : Integer);
93 | begin
94 | self.Lastname := Lastname;
95 | self.Firstname := Firstname;
96 | self.Age := Age;
97 | end;
98 |
99 | function TPerson.ToString: string;
100 | begin
101 | Result := Format('%s %s : Age %d', [Firstname, Lastname, Age]);
102 | end;
103 |
104 |
105 | { TPersonComparer }
106 |
107 | function TPersonComparer.Compare(const Left, Right: TPerson): Integer;
108 | begin
109 | Result := CompareText(Left.Lastname + Left.Firstname, Right.Lastname + Right.Firstname);
110 | end;
111 |
112 | end.
113 |
--------------------------------------------------------------------------------
/GenericCollections/D. Sorting Revisited/DSortingRevisited.dpr:
--------------------------------------------------------------------------------
1 | program DSortingRevisited;
2 |
3 | uses
4 | Forms,
5 | Unit1 in 'Unit1.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.MainFormOnTaskbar := True;
12 | Application.CreateForm(TForm1, Form1);
13 | Application.Run;
14 | end.
15 |
--------------------------------------------------------------------------------
/GenericCollections/D. Sorting Revisited/DSortingRevisited.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {7EDE705A-930F-4ACB-B086-70D2202ECBA1}
4 | DSortingRevisited.dpr
5 | 13.4
6 | True
7 | Debug
8 | Application
9 | VCL
10 | DCC32
11 | Win32
12 | 1
13 |
14 |
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | true
24 | Base
25 | true
26 |
27 |
28 | true
29 | Base
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | 1033
39 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
40 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
41 | 00400000
42 | .\$(Config)\$(Platform)
43 | .\$(Config)\$(Platform)
44 | false
45 | false
46 | false
47 | false
48 | false
49 |
50 |
51 | DSortingRevisited_Icon.ico
52 |
53 |
54 | true
55 | DSortingRevisited_Icon.ico
56 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
57 | 1033
58 | $(BDS)\bin\default_app.manifest
59 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
60 |
61 |
62 | DEBUG;$(DCC_Define)
63 | false
64 | true
65 |
66 |
67 | false
68 | RELEASE;$(DCC_Define)
69 | 0
70 | false
71 |
72 |
73 |
74 | MainSource
75 |
76 |
77 |
78 |
79 |
80 | Cfg_2
81 | Base
82 |
83 |
84 | Base
85 |
86 |
87 | Cfg_1
88 | Base
89 |
90 |
91 |
92 |
93 | Delphi.Personality.12
94 |
95 |
96 |
97 |
98 | False
99 | False
100 | 1
101 | 0
102 | 0
103 | 0
104 | False
105 | False
106 | False
107 | False
108 | False
109 | 1033
110 | 1252
111 |
112 |
113 |
114 |
115 | 1.0.0.0
116 |
117 |
118 |
119 |
120 |
121 | 1.0.0.0
122 |
123 |
124 |
125 | DSortingRevisited.dpr
126 |
127 |
128 |
129 | False
130 | True
131 |
132 |
133 | 12
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/GenericCollections/D. Sorting Revisited/DSortingRevisited.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/GenericCollections/D. Sorting Revisited/DSortingRevisited.res
--------------------------------------------------------------------------------
/GenericCollections/D. Sorting Revisited/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 290
6 | ClientWidth = 315
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | OnDestroy = FormDestroy
16 | DesignSize = (
17 | 315
18 | 290)
19 | PixelsPerInch = 96
20 | TextHeight = 13
21 | object Button1: TButton
22 | Left = 8
23 | Top = 8
24 | Width = 75
25 | Height = 25
26 | Caption = 'List People'
27 | TabOrder = 0
28 | OnClick = Button1Click
29 | end
30 | object ListBox1: TListBox
31 | Left = 8
32 | Top = 39
33 | Width = 299
34 | Height = 243
35 | Anchors = [akLeft, akTop, akRight, akBottom]
36 | ItemHeight = 13
37 | TabOrder = 1
38 | end
39 | object Button2: TButton
40 | Left = 89
41 | Top = 8
42 | Width = 75
43 | Height = 25
44 | Caption = 'Sort'
45 | TabOrder = 2
46 | OnClick = Button2Click
47 | end
48 | object Button3: TButton
49 | Left = 170
50 | Top = 8
51 | Width = 75
52 | Height = 25
53 | Caption = 'Sort By Age'
54 | TabOrder = 3
55 | OnClick = Button3Click
56 | end
57 | end
58 |
--------------------------------------------------------------------------------
/GenericCollections/D. Sorting Revisited/Unit1.pas:
--------------------------------------------------------------------------------
1 | unit Unit1;
2 |
3 | interface
4 |
5 | uses
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 | Dialogs, Generics.Collections, StdCtrls, Generics.Defaults;
8 |
9 | type
10 | TPerson = class
11 | private
12 | FFirstname: string;
13 | FLastname: string;
14 | FAge: Integer;
15 | public
16 | function ToString: string; override;
17 | property Firstname: string read FFirstname write FFirstname;
18 | property Lastname: string read FLastname write FLastname;
19 | property Age: Integer read FAge write FAge;
20 | constructor Create(const Firstname, Lastname : string; Age : Integer); virtual;
21 | end;
22 |
23 | TForm1 = class(TForm)
24 | Button1: TButton;
25 | ListBox1: TListBox;
26 | Button2: TButton;
27 | Button3: TButton;
28 | procedure FormCreate(Sender: TObject);
29 | procedure FormDestroy(Sender: TObject);
30 | procedure Button1Click(Sender: TObject);
31 | procedure Button2Click(Sender: TObject);
32 | procedure Button3Click(Sender: TObject);
33 | private
34 | { Private declarations }
35 | FPersonList : TObjectList;
36 | procedure LoadListbox;
37 | public
38 | { Public declarations }
39 | end;
40 |
41 | var
42 | Form1: TForm1;
43 |
44 | implementation
45 |
46 | {$R *.dfm}
47 |
48 | procedure TForm1.Button1Click(Sender: TObject);
49 | begin
50 | LoadListbox;
51 | end;
52 |
53 | procedure TForm1.Button2Click(Sender: TObject);
54 | var
55 | PersonCompare : TComparison;
56 | begin
57 | PersonCompare := function(const Left, Right: TPerson): Integer
58 | begin
59 | Result := CompareText(Left.Lastname + Left.Firstname, Right.Lastname + Right.Firstname);
60 | end;
61 |
62 | FPersonList.Sort(TDelegatedComparer.Create(PersonCompare));
63 |
64 | LoadListbox;
65 | end;
66 |
67 | procedure TForm1.Button3Click(Sender: TObject);
68 | var
69 | AgeCompare : TComparison;
70 | begin
71 | AgeCompare := function(const Left, Right: TPerson): Integer
72 | begin
73 | Result := Left.Age - Right.Age;
74 | end;
75 |
76 | FPersonList.Sort(TDelegatedComparer.Create(AgeCompare));
77 |
78 | LoadListbox;
79 | end;
80 |
81 | procedure TForm1.LoadListbox;
82 | var
83 | Person: TPerson;
84 | begin
85 | ListBox1.Clear;
86 | for Person in FPersonList do
87 | ListBox1.Items.Add(Person.ToString);
88 | end;
89 |
90 | procedure TForm1.FormCreate(Sender: TObject);
91 | begin
92 | FPersonList := TObjectList.Create(True);
93 |
94 | FPersonList.Add(TPerson.Create('Fred', 'Flintstone', 40));
95 | FPersonList.Add(TPerson.Create('Wilma', 'Flintstone', 38));
96 | FPersonList.Add(TPerson.Create('Pebbles', 'Flintstone', 1));
97 | FPersonList.Add(TPerson.Create('Barney', 'Rubble', 38));
98 | FPersonList.Add(TPerson.Create('Betty', 'Rubble', 40));
99 | FPersonList.Add(TPerson.Create('Bam Bam', 'Rubble', 2));
100 | end;
101 |
102 |
103 | procedure TForm1.FormDestroy(Sender: TObject);
104 | begin
105 | FPersonList.Free;
106 | end;
107 |
108 | { TPerson }
109 |
110 | constructor TPerson.Create(const Firstname, Lastname : string; Age : Integer);
111 | begin
112 | self.Lastname := Lastname;
113 | self.Firstname := Firstname;
114 | self.Age := Age;
115 | end;
116 |
117 | function TPerson.ToString: string;
118 | begin
119 | Result := Format('%s %s : Age %d', [Firstname, Lastname, Age]);
120 | end;
121 |
122 | end.
123 |
--------------------------------------------------------------------------------
/GenericCollections/E. Search/ESearch.dpr:
--------------------------------------------------------------------------------
1 | program ESearch;
2 |
3 | uses
4 | Forms,
5 | Unit1 in 'Unit1.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.MainFormOnTaskbar := True;
12 | Application.CreateForm(TForm1, Form1);
13 | Application.Run;
14 | end.
15 |
--------------------------------------------------------------------------------
/GenericCollections/E. Search/ESearch.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {7EDE705A-930F-4ACB-B086-70D2202ECBA1}
4 | ESearch.dpr
5 | 13.4
6 | True
7 | Debug
8 | Application
9 | VCL
10 | DCC32
11 | Win32
12 | 1
13 |
14 |
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | true
24 | Base
25 | true
26 |
27 |
28 | true
29 | Base
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | 1033
39 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
40 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
41 | 00400000
42 | .\$(Config)\$(Platform)
43 | .\$(Config)\$(Platform)
44 | false
45 | false
46 | false
47 | false
48 | false
49 |
50 |
51 | ESearch_Icon.ico
52 |
53 |
54 | true
55 | ESearch_Icon.ico
56 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
57 | 1033
58 | $(BDS)\bin\default_app.manifest
59 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
60 |
61 |
62 | DEBUG;$(DCC_Define)
63 | false
64 | true
65 |
66 |
67 | false
68 | RELEASE;$(DCC_Define)
69 | 0
70 | false
71 |
72 |
73 |
74 | MainSource
75 |
76 |
77 |
78 |
79 |
80 | Cfg_2
81 | Base
82 |
83 |
84 | Base
85 |
86 |
87 | Cfg_1
88 | Base
89 |
90 |
91 |
92 |
93 | Delphi.Personality.12
94 |
95 |
96 |
97 |
98 | False
99 | False
100 | 1
101 | 0
102 | 0
103 | 0
104 | False
105 | False
106 | False
107 | False
108 | False
109 | 1033
110 | 1252
111 |
112 |
113 |
114 |
115 | 1.0.0.0
116 |
117 |
118 |
119 |
120 |
121 | 1.0.0.0
122 |
123 |
124 |
125 | ESearch.dpr
126 |
127 |
128 |
129 | False
130 | True
131 |
132 |
133 | 12
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/GenericCollections/E. Search/ESearch.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/GenericCollections/E. Search/ESearch.res
--------------------------------------------------------------------------------
/GenericCollections/E. Search/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 290
6 | ClientWidth = 532
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | OnDestroy = FormDestroy
16 | DesignSize = (
17 | 532
18 | 290)
19 | PixelsPerInch = 96
20 | TextHeight = 13
21 | object Button1: TButton
22 | Left = 8
23 | Top = 8
24 | Width = 75
25 | Height = 25
26 | Caption = 'List People'
27 | TabOrder = 0
28 | OnClick = Button1Click
29 | end
30 | object ListBox1: TListBox
31 | Left = 8
32 | Top = 39
33 | Width = 516
34 | Height = 243
35 | Anchors = [akLeft, akTop, akRight, akBottom]
36 | ItemHeight = 13
37 | TabOrder = 1
38 | end
39 | object Button2: TButton
40 | Left = 89
41 | Top = 8
42 | Width = 75
43 | Height = 25
44 | Caption = 'Sort'
45 | TabOrder = 2
46 | OnClick = Button2Click
47 | end
48 | object edtFirstname: TEdit
49 | Left = 170
50 | Top = 10
51 | Width = 121
52 | Height = 21
53 | TabOrder = 3
54 | end
55 | object edtLastname: TEdit
56 | Left = 297
57 | Top = 10
58 | Width = 121
59 | Height = 21
60 | TabOrder = 4
61 | end
62 | object Button3: TButton
63 | Left = 424
64 | Top = 8
65 | Width = 75
66 | Height = 25
67 | Caption = 'Search'
68 | TabOrder = 5
69 | OnClick = Button3Click
70 | end
71 | end
72 |
--------------------------------------------------------------------------------
/GenericCollections/E. Search/Unit1.pas:
--------------------------------------------------------------------------------
1 | unit Unit1;
2 |
3 | interface
4 |
5 | uses
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 | Dialogs, Generics.Collections, StdCtrls, Generics.Defaults;
8 |
9 | type
10 | TPerson = class
11 | private
12 | FFirstname: string;
13 | FLastname: string;
14 | FAge: Integer;
15 | public
16 | function ToString: string; override;
17 | property Firstname: string read FFirstname write FFirstname;
18 | property Lastname: string read FLastname write FLastname;
19 | property Age: Integer read FAge write FAge;
20 | constructor Create(const Firstname, Lastname : string; Age : Integer); virtual;
21 | end;
22 |
23 | TForm1 = class(TForm)
24 | Button1: TButton;
25 | ListBox1: TListBox;
26 | Button2: TButton;
27 | edtFirstname: TEdit;
28 | edtLastname: TEdit;
29 | Button3: TButton;
30 | procedure FormCreate(Sender: TObject);
31 | procedure FormDestroy(Sender: TObject);
32 | procedure Button1Click(Sender: TObject);
33 | procedure Button2Click(Sender: TObject);
34 | procedure Button3Click(Sender: TObject);
35 | private
36 | { Private declarations }
37 | FPersonList : TObjectList;
38 | procedure LoadListbox;
39 | public
40 | { Public declarations }
41 | end;
42 |
43 | var
44 | Form1: TForm1;
45 |
46 | implementation
47 |
48 | {$R *.dfm}
49 |
50 | procedure TForm1.Button1Click(Sender: TObject);
51 | begin
52 | LoadListbox;
53 | end;
54 |
55 | procedure TForm1.Button2Click(Sender: TObject);
56 | begin
57 | FPersonList.Sort;
58 | LoadListbox;
59 | end;
60 |
61 | procedure TForm1.Button3Click(Sender: TObject);
62 | var
63 | Person: TPerson;
64 | i : Integer;
65 | begin
66 | Person := TPerson.Create(edtFirstname.Text, edtLastname.Text, 0);
67 | try
68 | if FPersonList.BinarySearch(Person, i) then
69 | ShowMessage(Format('Found : %s', [FPersonList.Items[i].ToString]))
70 | else
71 | ShowMessage('Not found');
72 | finally
73 | Person.Free;
74 | end;
75 | end;
76 |
77 | procedure TForm1.LoadListbox;
78 | var
79 | Person: TPerson;
80 | begin
81 | ListBox1.Clear;
82 | for Person in FPersonList do
83 | ListBox1.Items.Add(Person.ToString);
84 | end;
85 |
86 | procedure TForm1.FormCreate(Sender: TObject);
87 | var
88 | PersonCompare : TComparison;
89 | begin
90 | PersonCompare := function(const Left, Right: TPerson): Integer
91 | begin
92 | Result := CompareText(Left.Lastname + Left.Firstname, Right.Lastname + Right.Firstname);
93 | end;
94 |
95 | FPersonList := TObjectList.Create(TDelegatedComparer.Create(PersonCompare), True);
96 |
97 | FPersonList.Add(TPerson.Create('Fred', 'Flintstone', 40));
98 | FPersonList.Add(TPerson.Create('Wilma', 'Flintstone', 38));
99 | FPersonList.Add(TPerson.Create('Pebbles', 'Flintstone', 1));
100 | FPersonList.Add(TPerson.Create('Barney', 'Rubble', 38));
101 | FPersonList.Add(TPerson.Create('Betty', 'Rubble', 40));
102 | FPersonList.Add(TPerson.Create('Bam Bam', 'Rubble', 2));
103 | end;
104 |
105 |
106 | procedure TForm1.FormDestroy(Sender: TObject);
107 | begin
108 | FPersonList.Free;
109 | end;
110 |
111 | { TPerson }
112 |
113 | constructor TPerson.Create(const Firstname, Lastname : string; Age : Integer);
114 | begin
115 | self.Lastname := Lastname;
116 | self.Firstname := Firstname;
117 | self.Age := Age;
118 | end;
119 |
120 | function TPerson.ToString: string;
121 | begin
122 | Result := Format('%s %s : Age %d', [Firstname, Lastname, Age]);
123 | end;
124 |
125 |
126 | end.
127 |
--------------------------------------------------------------------------------
/GenericCollections/F. Dictionary/FAussieDictionary.dpr:
--------------------------------------------------------------------------------
1 | program FAussieDictionary;
2 |
3 | uses
4 | Forms,
5 | Unit1 in 'Unit1.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.MainFormOnTaskbar := True;
12 | Application.CreateForm(TForm1, Form1);
13 | Application.Run;
14 | end.
15 |
--------------------------------------------------------------------------------
/GenericCollections/F. Dictionary/FAussieDictionary.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {09CC0DF5-2D60-4199-813F-4FE2CE8A226F}
4 | FAussieDictionary.dpr
5 | 13.4
6 | True
7 | Debug
8 | Application
9 | VCL
10 | DCC32
11 | Win32
12 | 1
13 |
14 |
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | true
24 | Base
25 | true
26 |
27 |
28 | true
29 | Base
30 | true
31 |
32 |
33 | true
34 | Base
35 | true
36 |
37 |
38 | 1033
39 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
40 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
41 | 00400000
42 | .\$(Config)\$(Platform)
43 | .\$(Config)\$(Platform)
44 | false
45 | false
46 | false
47 | false
48 | false
49 |
50 |
51 | FAussieDictionary_Icon.ico
52 | $(BDS)\bin\default_app.manifest
53 |
54 |
55 | true
56 | FAussieDictionary_Icon.ico
57 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
58 | 1033
59 | $(BDS)\bin\default_app.manifest
60 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
61 |
62 |
63 | DEBUG;$(DCC_Define)
64 | false
65 | true
66 |
67 |
68 | false
69 | RELEASE;$(DCC_Define)
70 | 0
71 | false
72 |
73 |
74 |
75 | MainSource
76 |
77 |
78 |
79 |
80 |
81 | Cfg_2
82 | Base
83 |
84 |
85 | Base
86 |
87 |
88 | Cfg_1
89 | Base
90 |
91 |
92 |
93 |
94 | Delphi.Personality.12
95 |
96 |
97 |
98 |
99 | False
100 | False
101 | 1
102 | 0
103 | 0
104 | 0
105 | False
106 | False
107 | False
108 | False
109 | False
110 | 1033
111 | 1252
112 |
113 |
114 |
115 |
116 | 1.0.0.0
117 |
118 |
119 |
120 |
121 |
122 | 1.0.0.0
123 |
124 |
125 |
126 | FAussieDictionary.dpr
127 |
128 |
129 |
130 | False
131 | True
132 |
133 |
134 | 12
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/GenericCollections/F. Dictionary/FAussieDictionary.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/GenericCollections/F. Dictionary/FAussieDictionary.res
--------------------------------------------------------------------------------
/GenericCollections/F. Dictionary/Unit1.dfm:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 560
6 | ClientWidth = 575
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | DesignSize = (
16 | 575
17 | 560)
18 | PixelsPerInch = 96
19 | TextHeight = 13
20 | object lbxDefinitions: TListBox
21 | Left = 8
22 | Top = 40
23 | Width = 559
24 | Height = 512
25 | Anchors = [akLeft, akTop, akRight, akBottom]
26 | ItemHeight = 13
27 | TabOrder = 0
28 | end
29 | object edtPhrase: TEdit
30 | Left = 8
31 | Top = 13
32 | Width = 478
33 | Height = 21
34 | Anchors = [akLeft, akTop, akRight]
35 | TabOrder = 1
36 | OnChange = edtPhraseChange
37 | end
38 | object Button1: TButton
39 | Left = 492
40 | Top = 11
41 | Width = 75
42 | Height = 25
43 | Caption = 'Search'
44 | TabOrder = 2
45 | OnClick = Button1Click
46 | end
47 | end
48 |
--------------------------------------------------------------------------------
/GenericCollections/F. Dictionary/Unit1.pas:
--------------------------------------------------------------------------------
1 | unit Unit1;
2 |
3 | interface
4 |
5 | uses
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 | Dialogs, StdCtrls, Generics.Collections;
8 |
9 | type
10 | TForm1 = class(TForm)
11 | lbxDefinitions: TListBox;
12 | edtPhrase: TEdit;
13 | Button1: TButton;
14 | procedure FormCreate(Sender: TObject);
15 | procedure Button1Click(Sender: TObject);
16 | procedure edtPhraseChange(Sender: TObject);
17 | private
18 | { Private declarations }
19 | FAussieDictionary : TObjectDictionary>;
20 | public
21 | { Public declarations }
22 | end;
23 |
24 | var
25 | Form1: TForm1;
26 |
27 | implementation
28 | uses
29 | Generics.Defaults;
30 |
31 | {$R *.dfm}
32 |
33 | procedure TForm1.Button1Click(Sender: TObject);
34 | var
35 | Definition: String;
36 | begin
37 | if FAussieDictionary.ContainsKey(edtPhrase.Text) then
38 | for Definition in FAussieDictionary.Items[edtPhrase.Text] do
39 | lbxDefinitions.Items.Add(Definition);
40 | end;
41 |
42 | procedure TForm1.edtPhraseChange(Sender: TObject);
43 | begin
44 | if lbxDefinitions.Count > 0 then
45 | lbxDefinitions.Clear;
46 | end;
47 |
48 | procedure TForm1.FormCreate(Sender: TObject);
49 | var
50 | DefinitionList : TList;
51 | begin
52 | FAussieDictionary := TObjectDictionary>.Create([doOwnsValues]);
53 |
54 | {$REGION 'Load Dictionary'}
55 | DefinitionList := TList.Create;
56 | DefinitionList.Add('a very long way away');
57 | FAussieDictionary.Add('Back of Bourke', DefinitionList);
58 |
59 | DefinitionList := TList.Create;
60 | DefinitionList.Add('lazy person');
61 | DefinitionList.Add('layabout');
62 | DefinitionList.Add('somebody who always relies on other people to do things or lend him things');
63 | FAussieDictionary.Add('Bludger', DefinitionList);
64 |
65 | DefinitionList := TList.Create;
66 | DefinitionList.Add('Bottle of wine without a label');
67 | DefinitionList.Add('cattle that have not been branded, earmarked or castrated.');
68 | FAussieDictionary.Add('Cleanskin', DefinitionList);
69 |
70 | DefinitionList := TList.Create;
71 | DefinitionList.Add('farmer');
72 | DefinitionList.Add('cockatoo');
73 | DefinitionList.Add('cockroach');
74 | FAussieDictionary.Add('Cockie', DefinitionList);
75 |
76 | DefinitionList := TList.Create;
77 | DefinitionList.Add('pack, equipment');
78 | DefinitionList.Add('traffic ticket');
79 | DefinitionList.Add('redhead');
80 | DefinitionList.Add('blue cattle dog');
81 | DefinitionList.Add('heavy wool or felt jacket worn by mining and construction workers');
82 | DefinitionList.Add('bluebottle jellyfish');
83 | FAussieDictionary.Add('Bluey', DefinitionList);
84 |
85 | {$ENDREGION}
86 |
87 |
88 | end;
89 |
90 | end.
91 |
--------------------------------------------------------------------------------
/GenericCollections/GenericCollectionsSamples.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {96F5D06A-3DC4-4046-8DE5-75CBAB084291}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Default.Personality.12
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/CustomGeneratorsGroup.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {4E4B5D87-CE26-4AF4-A8D9-04555282EEEC}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/EmailGenerator.pas:
--------------------------------------------------------------------------------
1 | unit EmailGenerator;
2 |
3 | // Sample data generator for TPrototypeBindSource or TDataGeneratorAdapter. To make these generaters available at
4 | // design time, add this unit to a package and install the package.
5 | interface
6 |
7 | implementation
8 |
9 | uses Data.Bind.ObjectScope, Data.Bind.GenData, Generics.Collections, SysUtils;
10 |
11 | type
12 | TEmailAddressGenerator = class(TDelegateValueGenerator)
13 | protected
14 | function CreateDelegate: TValueGeneratorDelegate; override;
15 | end;
16 |
17 | const
18 | sEmailAddresses = 'EmailAddresses';
19 |
20 | const
21 | CDomainExtensions: array[0..18] of string =
22 | (
23 | 'com', 'org', 'net', 'mobi', 'info',
24 | 'com.au', 'org.au', 'net.au',
25 | 'com.sg', 'org.sg', 'net.sg',
26 | 'com.cn', 'net.cn', 'gov.cn',
27 | 'co.jp', 'ed.jp',
28 | 'co.uk', 'gov.uk', 'net.uk'
29 | );
30 |
31 | function LoadAddresses: TArray;
32 | function RandomString(Length : Integer) : string;
33 | const
34 | s = 'abcdefghijklmnopqrstuvwxyz';
35 | var
36 | I, strLength: Integer;
37 | begin
38 | strLength := System.Length(s);
39 | Result := '';
40 |
41 | for I := 0 to Length do
42 | Result := Result + s[Random(strLength) + 1];
43 | end;
44 | var
45 | LList: TList;
46 | LAddress : string;
47 | I: Integer;
48 | begin
49 | Randomize;
50 | LList := TList.Create;
51 | try
52 | for I := 0 to 200 do
53 | begin
54 |
55 | LAddress := Format('%s@%s.%s', [RandomString(Random(8) + 3),
56 | RandomString(Random(8) + 3),
57 | CDomainExtensions[Random(18)]]);
58 | LList.Add(LAddress);
59 | end;
60 | Result := LList.ToArray;
61 | finally
62 | LList.Free;
63 | end;
64 | end;
65 |
66 |
67 | function TEmailAddressGenerator.CreateDelegate: TValueGeneratorDelegate;
68 | begin
69 | Result := nil;
70 | case FieldType of
71 | ftString:
72 | Result := TTypedListValueGeneratorDelegate.Create(Options,
73 | LoadAddresses);
74 | else
75 | Assert(False);
76 | end;
77 | end;
78 |
79 | initialization
80 | RegisterValueGenerator(sEmailAddresses, [ftString],
81 | TValueGeneratorDescription.Create(TEmailAddressGenerator, 'Email%d', 'EmailGenerator'));
82 | finalization
83 | UnRegisterValueGenerator(sEmailAddresses, [ftString], '');
84 | end.
85 |
86 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/MGCustomGenerator.dpk:
--------------------------------------------------------------------------------
1 | package MGCustomGenerator;
2 |
3 | {$R *.res}
4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
5 | {$ALIGN 8}
6 | {$ASSERTIONS ON}
7 | {$BOOLEVAL OFF}
8 | {$DEBUGINFO ON}
9 | {$EXTENDEDSYNTAX ON}
10 | {$IMPORTEDDATA ON}
11 | {$IOCHECKS ON}
12 | {$LOCALSYMBOLS ON}
13 | {$LONGSTRINGS ON}
14 | {$OPENSTRINGS ON}
15 | {$OPTIMIZATION OFF}
16 | {$OVERFLOWCHECKS OFF}
17 | {$RANGECHECKS OFF}
18 | {$REFERENCEINFO ON}
19 | {$SAFEDIVIDE OFF}
20 | {$STACKFRAMES ON}
21 | {$TYPEDADDRESS OFF}
22 | {$VARSTRINGCHECKS ON}
23 | {$WRITEABLECONST OFF}
24 | {$MINENUMSIZE 1}
25 | {$IMAGEBASE $400000}
26 | {$DEFINE DEBUG}
27 | {$ENDIF IMPLICITBUILDING}
28 | {$IMPLICITBUILD ON}
29 |
30 | requires
31 | rtl,
32 | bindengine,
33 | bindcomp;
34 |
35 | contains
36 | EmailGenerator in 'EmailGenerator.pas';
37 |
38 | end.
39 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/MGCustomGenerator.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {1628759D-B1C4-4BDE-876B-193F26A2605B}
4 | MGCustomGenerator.dpk
5 | 14.3
6 | None
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Package
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | true
49 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
50 | true
51 | All
52 | .\$(Platform)\$(Config)
53 | .\$(Platform)\$(Config)
54 | false
55 | false
56 | false
57 | false
58 | false
59 |
60 |
61 | rtl;bindengine;bindcomp;$(DCC_UsePackage)
62 |
63 |
64 | rtl;bindengine;bindcomp;$(DCC_UsePackage)
65 | true
66 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
67 | 1033
68 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
69 |
70 |
71 | rtl;bindengine;bindcomp;$(DCC_UsePackage)
72 |
73 |
74 | DEBUG;$(DCC_Define)
75 | true
76 | false
77 | true
78 | true
79 | true
80 |
81 |
82 | false
83 |
84 |
85 | false
86 | RELEASE;$(DCC_Define)
87 | 0
88 | false
89 |
90 |
91 |
92 | MainSource
93 |
94 |
95 |
96 |
97 |
98 |
99 | Cfg_2
100 | Base
101 |
102 |
103 | Base
104 |
105 |
106 | Cfg_1
107 | Base
108 |
109 |
110 |
111 | Delphi.Personality.12
112 | Package
113 |
114 |
115 |
116 | MGCustomGenerator.dpk
117 |
118 |
119 | True
120 | False
121 | 1
122 | 0
123 | 0
124 | 0
125 | False
126 | False
127 | False
128 | False
129 | False
130 | 1033
131 | 1252
132 |
133 |
134 |
135 |
136 | 1.0.0.0
137 |
138 |
139 |
140 |
141 |
142 | 1.0.0.0
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | False
157 | True
158 | False
159 |
160 |
161 | 12
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/Project3.dpr:
--------------------------------------------------------------------------------
1 | program Project3;
2 |
3 | uses
4 | FMX.Forms,
5 | Unit4 in 'Unit4.pas' {Form4};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.CreateForm(TForm4, Form4);
12 | Application.Run;
13 | end.
14 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/Project3.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {544714D6-8B17-4599-B82B-CF4CDAE5A36D}
4 | 14.3
5 | FMX
6 | Project3.dpr
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
49 | $(BDS)\bin\delphi_PROJECTICON.ico
50 | .\$(Platform)\$(Config)
51 | .\$(Platform)\$(Config)
52 | false
53 | false
54 | false
55 | false
56 | false
57 |
58 |
59 | bindcompfmx;DBXSqliteDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;dbxcds;DBXMySQLDriver;bindengine;soaprtl;bindcompdbx;DBXOracleDriver;CustomIPTransport;dsnap;IndyIPServer;DBXInformixDriver;fmxase;IndyCore;IndyIPCommon;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
60 |
61 |
62 | $(BDS)\bin\default_app.manifest
63 | bindcompfmx;DBXSqliteDriver;vcldbx;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;TeeDB;bindcomp;inetdb;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;DataSnapProviderClient;xmlrtl;svnui;ibxpress;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;MetropolisUILiveTile;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;FMXTee;TeeUI;CustomLBMethods;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;Intraweb;fmxase;vcl;IndyCore;DataSnapConnectors;CodeSiteExpressPkg;IndyIPCommon;CloudService;dsnapcon;DBXFirebirdDriver;DBXMSSQLDriver;inet;FmxTeeUI;fmxobj;vclx;inetdbxpress;webdsnap;svn;DBXSybaseASADriver;fmxdae;bdertl;SampleAdapterPackage;dbexpress;adortl;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
64 | true
65 | 1033
66 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
67 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
68 |
69 |
70 | bindcompfmx;DBXSqliteDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;fmxase;vcl;IndyCore;IndyIPCommon;dsnapcon;DBXFirebirdDriver;DBXMSSQLDriver;inet;fmxobj;vclx;inetdbxpress;webdsnap;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
71 |
72 |
73 | DEBUG;$(DCC_Define)
74 | true
75 | false
76 | true
77 | true
78 | true
79 |
80 |
81 | false
82 |
83 |
84 | false
85 | RELEASE;$(DCC_Define)
86 | 0
87 | false
88 |
89 |
90 |
91 | MainSource
92 |
93 |
94 |
95 | fmx
96 |
97 |
98 | Cfg_2
99 | Base
100 |
101 |
102 | Base
103 |
104 |
105 | Cfg_1
106 | Base
107 |
108 |
109 |
110 | Delphi.Personality.12
111 |
112 |
113 |
114 |
115 | False
116 | False
117 | 1
118 | 0
119 | 0
120 | 0
121 | False
122 | False
123 | False
124 | False
125 | False
126 | 1033
127 | 1252
128 |
129 |
130 |
131 |
132 | 1.0.0.0
133 |
134 |
135 |
136 |
137 |
138 | 1.0.0.0
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | Project3.dpr
151 |
152 |
153 |
154 |
155 | False
156 | True
157 | False
158 |
159 |
160 | 12
161 |
162 |
163 |
164 |
165 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/Unit4.fmx:
--------------------------------------------------------------------------------
1 | object Form4: TForm4
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form4'
5 | ClientHeight = 480
6 | ClientWidth = 292
7 | FormFactor.Width = 1680
8 | FormFactor.Height = 1050
9 | FormFactor.Devices = [dkDesktop]
10 | object Grid1: TGrid
11 | Touch.InteractiveGestures = [igPan]
12 | Height = 393.000000000000000000
13 | Position.X = 24.000000000000000000
14 | Position.Y = 56.000000000000000000
15 | Width = 241.000000000000000000
16 | RowCount = 200
17 | RowHeight = 21.000000000000000000
18 | object TStringColumn
19 | Header = 'Email'
20 | Height = 368.000000000000000000
21 | Width = 180.000000000000000000
22 | end
23 | end
24 | object NavigatorPrototypeBindSource1: TBindNavigator
25 | Height = 25.000000000000000000
26 | Position.X = 24.000000000000000000
27 | Position.Y = 16.000000000000000000
28 | Width = 240.000000000000000000
29 | DataSource = PrototypeBindSource1
30 | xRadius = 4.000000000000000000
31 | yRadius = 4.000000000000000000
32 | end
33 | object PrototypeBindSource1: TPrototypeBindSource
34 | AutoActivate = True
35 | FieldDefs = <
36 | item
37 | Name = 'Email'
38 | Generator = 'EmailAddresses'
39 | ReadOnly = False
40 | end>
41 | ScopeMappings = <>
42 | Left = 224
43 | Top = 256
44 | end
45 | object BindingsList1: TBindingsList
46 | Methods = <>
47 | OutputConverters = <>
48 | UseAppManager = True
49 | Left = 228
50 | Top = 181
51 | object LinkGridToDataSource1: TLinkGridToDataSource
52 | Category = 'Quick Bindings'
53 | DataSource = PrototypeBindSource1
54 | GridControl = Grid1
55 | AutoBufferCount = False
56 | Columns = <
57 | item
58 | MemberName = 'Email'
59 | Width = 180
60 | end>
61 | end
62 | end
63 | end
64 |
--------------------------------------------------------------------------------
/LiveBindings/Custom Generator/Unit4.pas:
--------------------------------------------------------------------------------
1 | unit Unit4;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
7 | System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
8 | Data.Bind.Components, Data.Bind.ObjectScope, EmailGenerator, Data.Bind.EngExt, Fmx.Bind.DBEngExt, Fmx.Bind.Grid,
9 | System.Bindings.Outputs, Fmx.Bind.Editors, FMX.Layouts, Fmx.Bind.Navigator,
10 | Data.Bind.Grid, FMX.Grid, MyCustomExprMethods;
11 |
12 | type
13 | TForm4 = class(TForm)
14 | PrototypeBindSource1: TPrototypeBindSource;
15 | Grid1: TGrid;
16 | BindingsList1: TBindingsList;
17 | LinkGridToDataSource1: TLinkGridToDataSource;
18 | NavigatorPrototypeBindSource1: TBindNavigator;
19 | private
20 | { Private declarations }
21 | public
22 | { Public declarations }
23 | end;
24 |
25 | var
26 | Form4: TForm4;
27 |
28 | implementation
29 |
30 | {$R *.fmx}
31 |
32 | end.
33 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/CurrencyToStrMethod.pas:
--------------------------------------------------------------------------------
1 | unit CurrencyToStrMethod;
2 |
3 | interface
4 |
5 | implementation
6 | uses System.Bindings.Methods, System.SysUtils, MethodUtils;
7 |
8 | const
9 | sIDCurrencyToStr = 'CurrencyToStr';
10 | sIDStrToCurrency = 'StrToCurrency';
11 |
12 | procedure RegisterMethods;
13 | begin
14 | TMethodUtils.RegisterMethod(sIDCurrencyToStr,
15 | function(AValue: Currency): string
16 | begin
17 | Result := CurrToStrF(AValue, ffCurrency, 2);
18 | end);
19 |
20 | TMethodUtils.RegisterMethod(sIDStrToCurrency,
21 | function(AValue: string): Currency
22 | var
23 | C: char;
24 | LDigits: string;
25 | begin
26 | for C in AValue do
27 | case C of
28 | '0'..'9',
29 | '.':
30 | LDigits := LDigits + C;
31 | end;
32 | Result := StrToCurr(LDigits)
33 | end);
34 | end;
35 |
36 | procedure UnregisterMethods;
37 | begin
38 | TBindingMethodsFactory.UnRegisterMethod(sIDCurrencyToStr);
39 | TBindingMethodsFactory.UnRegisterMethod(sIDStrToCurrency);
40 | end;
41 |
42 | initialization
43 | RegisterMethods;
44 | finalization
45 | UnregisterMethods;
46 | end.
47 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/MGCustomLiveBindingMethods.dpk:
--------------------------------------------------------------------------------
1 | package MGCustomLiveBindingMethods;
2 |
3 | {$R *.res}
4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
5 | {$ALIGN 8}
6 | {$ASSERTIONS ON}
7 | {$BOOLEVAL OFF}
8 | {$DEBUGINFO ON}
9 | {$EXTENDEDSYNTAX ON}
10 | {$IMPORTEDDATA ON}
11 | {$IOCHECKS ON}
12 | {$LOCALSYMBOLS ON}
13 | {$LONGSTRINGS ON}
14 | {$OPENSTRINGS ON}
15 | {$OPTIMIZATION OFF}
16 | {$OVERFLOWCHECKS OFF}
17 | {$RANGECHECKS OFF}
18 | {$REFERENCEINFO ON}
19 | {$SAFEDIVIDE OFF}
20 | {$STACKFRAMES ON}
21 | {$TYPEDADDRESS OFF}
22 | {$VARSTRINGCHECKS ON}
23 | {$WRITEABLECONST OFF}
24 | {$MINENUMSIZE 1}
25 | {$IMAGEBASE $400000}
26 | {$DEFINE DEBUG}
27 | {$ENDIF IMPLICITBUILDING}
28 | {$IMPLICITBUILD ON}
29 |
30 | requires
31 | rtl,
32 | bindengine;
33 |
34 | contains
35 | CurrencyToStrMethod in 'CurrencyToStrMethod.pas',
36 | MethodUtils in 'MethodUtils.pas';
37 |
38 | end.
39 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/MGCustomLiveBindingMethods.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {67675D8F-494F-4A74-A82A-8C1AE89A32C0}
4 | MGCustomLiveBindingMethods.dpk
5 | 14.3
6 | None
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Package
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | true
49 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
50 | true
51 | All
52 | .\$(Platform)\$(Config)
53 | .\$(Platform)\$(Config)
54 | false
55 | false
56 | false
57 | false
58 | false
59 |
60 |
61 | rtl;bindengine;$(DCC_UsePackage)
62 |
63 |
64 | rtl;bindengine;$(DCC_UsePackage)
65 | true
66 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
67 | 1033
68 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
69 |
70 |
71 | rtl;bindengine;$(DCC_UsePackage)
72 |
73 |
74 | DEBUG;$(DCC_Define)
75 | true
76 | false
77 | true
78 | true
79 | true
80 |
81 |
82 | true
83 | 1033
84 | false
85 |
86 |
87 | false
88 | RELEASE;$(DCC_Define)
89 | 0
90 | false
91 |
92 |
93 |
94 | MainSource
95 |
96 |
97 |
98 |
99 |
100 |
101 | Cfg_2
102 | Base
103 |
104 |
105 | Base
106 |
107 |
108 | Cfg_1
109 | Base
110 |
111 |
112 |
113 | Delphi.Personality.12
114 | Package
115 |
116 |
117 |
118 | MGCustomLiveBindingMethods.dpk
119 |
120 |
121 | True
122 | False
123 | 1
124 | 0
125 | 0
126 | 0
127 | False
128 | False
129 | False
130 | False
131 | False
132 | 1033
133 | 1252
134 |
135 |
136 |
137 |
138 | 1.0.0.0
139 |
140 |
141 |
142 |
143 |
144 | 1.0.0.0
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | Embarcadero C++Builder Office 2000 Servers Package
157 | Embarcadero C++Builder Office XP Servers Package
158 | Microsoft Office 2000 Sample Automation Server Wrapper Components
159 | Microsoft Office XP Sample Automation Server Wrapper Components
160 |
161 |
162 |
163 |
164 | False
165 | True
166 | False
167 |
168 |
169 | 12
170 |
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/MethodUtils.pas:
--------------------------------------------------------------------------------
1 | unit MethodUtils;
2 |
3 |
4 | interface
5 |
6 | uses System.Classes, System.SysUtils,
7 | System.Bindings.EvalProtocol;
8 |
9 | type
10 | // Helper class to register LiveBindings Methods
11 | TMethodUtils = class
12 | private
13 | class procedure RegisterMethod(const AName: string; const AInvokable: IInvokable); overload;
14 | class procedure ValidateArgs(Args: TArray; AExpectedCount: Integer); static;
15 | public
16 | // Register a method with 0 parameters
17 | class procedure RegisterMethod(const AName: string; ACallback: TFunc); overload;
18 | // Register a method with 1 parameter
19 | class procedure RegisterMethod(const AName: string; ACallback: TFunc); overload;
20 | // Register a method with 2 parameters
21 | class procedure RegisterMethod(const AName: string; ACallback: TFunc); overload;
22 | // Register a method with 3 parameters
23 | class procedure RegisterMethod(const AName: string; ACallback: TFunc); overload;
24 | end;
25 |
26 | implementation
27 |
28 | uses System.Bindings.Methods, System.Bindings.Consts,
29 | System.Rtti;
30 |
31 | class procedure TMethodUtils.RegisterMethod(const AName: string;
32 | const AInvokable: IInvokable);
33 | begin
34 | TBindingMethodsFactory.RegisterMethod(
35 | TMethodDescription.Create(
36 | AInvokable,
37 | AName, // ID
38 | AName, // Method name
39 | '', // Unit name (design time support)
40 | True, // Enabled
41 | '', // Description (design time support)
42 | nil)); // Framework class
43 | end;
44 |
45 | class procedure TMethodUtils.ValidateArgs(Args: TArray; AExpectedCount: Integer);
46 | begin
47 | if Length(Args) <> AExpectedCount then
48 | raise EEvaluatorError.Create(Format(sUnexpectedArgCount, [AExpectedCount, Length(Args)]));
49 | end;
50 |
51 | class procedure TMethodUtils.RegisterMethod(const AName: string;
52 | ACallback: TFunc);
53 | begin
54 | RegisterMethod(
55 | AName,
56 | MakeInvokable(
57 | function(Args: TArray): IValue // Anonymous method
58 | begin
59 | ValidateArgs(Args, 0);
60 | Exit(TValueWrapper.Create(TValue.From(ACallback())))
61 | end
62 | )
63 | );
64 | end;
65 |
66 | class procedure TMethodUtils.RegisterMethod(const AName: string;
67 | ACallback: TFunc);
68 | begin
69 | RegisterMethod(
70 | AName,
71 | MakeInvokable(
72 | function(Args: TArray): IValue // Anonymous method
73 | var
74 | LParam1: T1;
75 | LParam2: T2;
76 | LParam3: T3;
77 | begin
78 | ValidateArgs(Args, 3);
79 | if Args[0].GetValue.TryAsType(LParam1) and
80 | Args[1].GetValue.TryAsType(LParam2) and
81 | Args[2].GetValue.TryAsType(LParam3) then
82 | Exit(TValueWrapper.Create(TValue.From(ACallback(LParam1, LParam2, LParam3))))
83 | else
84 | Exit(TValueWrapper.Create(nil));
85 | end
86 | )
87 | );
88 | end;
89 |
90 | class procedure TMethodUtils.RegisterMethod(const AName: string;
91 | ACallback: TFunc);
92 | begin
93 | RegisterMethod(
94 | AName,
95 | MakeInvokable(
96 | function(Args: TArray): IValue // Anonymous method
97 | var
98 | LParam1: T1;
99 | LParam2: T2;
100 | begin
101 | ValidateArgs(Args, 2);
102 | if Args[0].GetValue.TryAsType(LParam1) and
103 | Args[1].GetValue.TryAsType(LParam2) then
104 | Exit(TValueWrapper.Create(TValue.From(ACallback(LParam1, LParam2))))
105 | else
106 | Exit(TValueWrapper.Create(nil));
107 | end
108 | )
109 | );
110 | end;
111 |
112 | class procedure TMethodUtils.RegisterMethod(const AName: string;
113 | ACallback: TFunc);
114 | begin
115 | RegisterMethod(
116 | AName,
117 | MakeInvokable(
118 | function(Args: TArray): IValue // Anonymous method
119 | var
120 | LParam1: T1;
121 | begin
122 | ValidateArgs(Args, 1);
123 | if Args[0].GetValue.TryAsType(LParam1) then
124 | Exit(TValueWrapper.Create(TValue.From(ACallback(LParam1))))
125 | else
126 | Exit(TValueWrapper.Create(nil));
127 | end
128 | )
129 | );
130 | end;
131 |
132 | end.
133 |
134 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/Project4.dpr:
--------------------------------------------------------------------------------
1 | program Project4;
2 |
3 | uses
4 | FMX.Forms,
5 | Unit5 in 'Unit5.pas' {Form5};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.CreateForm(TForm5, Form5);
12 | Application.Run;
13 | end.
14 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/ProjectGroup1.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {EE367F72-5F3C-4A67-8E43-0EA91E8E1CC8}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/Unit5.fmx:
--------------------------------------------------------------------------------
1 | object Form5: TForm5
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form5'
5 | ClientHeight = 339
6 | ClientWidth = 260
7 | FormFactor.Width = 1680
8 | FormFactor.Height = 1050
9 | FormFactor.Devices = [dkDesktop]
10 | object EditAmount: TEdit
11 | DisableFocusEffect = False
12 | KeyboardType = vktDefault
13 | Password = False
14 | Text = '$67.67'
15 | Position.X = 8.000000000000000000
16 | Position.Y = 304.000000000000000000
17 | Width = 100.000000000000000000
18 | Height = 22.000000000000000000
19 | object Label1: TLabel
20 | Height = 15.000000000000000000
21 | Position.Y = -14.000000000000000000
22 | Text = 'Amount'
23 | Width = 120.000000000000000000
24 | WordWrap = False
25 | end
26 | end
27 | object NavigatorPrototypeBindSource1: TBindNavigator
28 | Height = 25.000000000000000000
29 | Position.X = 8.000000000000000000
30 | Position.Y = 8.000000000000000000
31 | Width = 240.000000000000000000
32 | DataSource = PrototypeBindSource1
33 | xRadius = 4.000000000000000000
34 | yRadius = 4.000000000000000000
35 | end
36 | object Label2: TLabel
37 | Height = 15.000000000000000000
38 | Position.X = 125.000000000000000000
39 | Position.Y = 307.000000000000000000
40 | Text = '67.67'
41 | Width = 120.000000000000000000
42 | end
43 | object Grid1: TGrid
44 | Touch.InteractiveGestures = [igPan]
45 | Height = 241.000000000000000000
46 | Position.X = 8.000000000000000000
47 | Position.Y = 40.000000000000000000
48 | Width = 241.000000000000000000
49 | RowCount = 200
50 | RowHeight = 21.000000000000000000
51 | object TStringColumn
52 | Header = 'Lastname'
53 | Height = 216.000000000000000000
54 | Width = 128.000000000000000000
55 | end
56 | object TStringColumn
57 | Header = 'Amount'
58 | Height = 216.000000000000000000
59 | Position.X = 128.000000000000000000
60 | Width = 64.000000000000000000
61 | end
62 | end
63 | object PrototypeBindSource1: TPrototypeBindSource
64 | AutoActivate = True
65 | FieldDefs = <
66 | item
67 | Name = 'Lastname'
68 | Generator = 'ColorsNames'
69 | ReadOnly = False
70 | end
71 | item
72 | Name = 'Amount'
73 | FieldType = ftCurrency
74 | Generator = 'Currency'
75 | ReadOnly = False
76 | end>
77 | ScopeMappings = <>
78 | Left = 200
79 | Top = 296
80 | end
81 | object BindingsList1: TBindingsList
82 | Methods = <>
83 | OutputConverters = <>
84 | UseAppManager = True
85 | Left = 148
86 | Top = 269
87 | object LinkControlToField1: TLinkControlToField
88 | Category = 'Quick Bindings'
89 | DataSource = PrototypeBindSource1
90 | FieldName = 'Amount'
91 | Control = EditAmount
92 | Track = False
93 | CustomFormat = 'CurrencyToStr(%s)'
94 | CustomParse = 'StrToCurrency(%s)'
95 | end
96 | object LinkPropertyToField1: TLinkPropertyToField
97 | Category = 'Quick Bindings'
98 | DataSource = PrototypeBindSource1
99 | FieldName = 'Amount'
100 | Component = Label2
101 | ComponentProperty = 'Text'
102 | end
103 | object LinkGridToDataSource1: TLinkGridToDataSource
104 | Category = 'Quick Bindings'
105 | DataSource = PrototypeBindSource1
106 | GridControl = Grid1
107 | AutoBufferCount = False
108 | Columns = <
109 | item
110 | MemberName = 'Lastname'
111 | Width = 128
112 | CustomFormat = '"Mr " + UpperCase(%s)'
113 | end
114 | item
115 | MemberName = 'Amount'
116 | end>
117 | end
118 | end
119 | end
120 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/Unit5.pas:
--------------------------------------------------------------------------------
1 | unit Unit5;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
7 | System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
8 | Data.Bind.GenData, System.Bindings.Outputs, Fmx.Bind.Editors,
9 | Data.Bind.EngExt, CurrencyToStrMethod, Fmx.Bind.DBEngExt,
10 | Data.Bind.Components, FMX.Layouts, Fmx.Bind.Navigator, FMX.Edit,
11 | Data.Bind.ObjectScope, FMX.Grid, Fmx.Bind.Grid, Data.Bind.Grid;
12 |
13 | type
14 | TForm5 = class(TForm)
15 | PrototypeBindSource1: TPrototypeBindSource;
16 | EditAmount: TEdit;
17 | Label1: TLabel;
18 | LinkControlToField1: TLinkControlToField;
19 | BindingsList1: TBindingsList;
20 | NavigatorPrototypeBindSource1: TBindNavigator;
21 | Label2: TLabel;
22 | LinkPropertyToField1: TLinkPropertyToField;
23 | Grid1: TGrid;
24 | LinkGridToDataSource1: TLinkGridToDataSource;
25 | private
26 | { Private declarations }
27 | public
28 | { Public declarations }
29 | end;
30 |
31 | var
32 | Form5: TForm5;
33 |
34 | implementation
35 |
36 | {$R *.fmx}
37 |
38 | end.
39 |
--------------------------------------------------------------------------------
/LiveBindings/Formatting your Fields/Unit5.vlb:
--------------------------------------------------------------------------------
1 | [PrototypeBindSource1]
2 | Coordinates=140,10,125,123
3 |
4 | [EditAmount]
5 | Coordinates=30,10,72,51
6 |
7 | [Label1]
8 | Coordinates=30,70,46,51
9 | Visible=False
10 |
11 | [Label2]
12 | Coordinates=30,80,46,51
13 |
14 | [Grid1]
15 | Coordinates=300,10,53,87
16 |
17 | [NavigatorPrototypeBindSource1]
18 | Visible=False
19 |
20 |
--------------------------------------------------------------------------------
/LiveBindings/Treating an Integer as a Boolean/IntToBool.dpr:
--------------------------------------------------------------------------------
1 | program IntToBool;
2 |
3 | uses
4 | FMX.Forms,
5 | Unit13 in 'Unit13.pas' {Form13};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.CreateForm(TForm13, Form13);
12 | Application.Run;
13 | end.
14 |
--------------------------------------------------------------------------------
/LiveBindings/Treating an Integer as a Boolean/IntToBool.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {73245788-3004-4906-B3CB-1F8975192F66}
4 | 15.1
5 | FMX
6 | IntToBool.dpr
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | $(BDS)\bin\delphi_PROJECTICON.ico
49 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
50 | $(BDS)\bin\delphi_PROJECTICNS.icns
51 | .\$(Platform)\$(Config)
52 | .\$(Platform)\$(Config)
53 | false
54 | false
55 | false
56 | false
57 | false
58 |
59 |
60 | IndyIPClient;AnyDAC_PhysADS_D18;AnyDAC_PhysODBC_D18;AnyDAC_GUIxForms_D18;DBXSqliteDriver;AnyDAC_ComI_D18;AnyDAC_PhysTDBX_D18;fmx;IndySystem;AnyDAC_PhysIB_D18;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DbxCommonDriver;dbxcds;AnyDAC_PhysMSAcc_D18;DBXOracleDriver;CustomIPTransport;dsnap;IndyIPServer;AnyDAC_PhysPg_D18;fmxase;IndyCore;IndyIPCommon;CloudService;AnyDAC_PhysMSSQL_D18;AnyDAC_PhysOracle_D18;inetdbxpress;AnyDAC_PhysMySQL_D18;AnyDAC_Phys_D18;AnyDAC_Comp_D18;bindcompfmx;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;bindengine;soaprtl;bindcompdbx;FMXTee;AnyDAC_PhysASA_D18;DBXInformixDriver;DBXFirebirdDriver;AnyDAC_PhysSQLITE_D18;inet;fmxobj;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;AnyDAC_PhysDb2_D18;$(DCC_UsePackage)
61 |
62 |
63 | IndyIPClient;AnyDAC_PhysADS_D18;AnyDAC_PhysODBC_D18;AnyDAC_GUIxForms_D18;DBXSqliteDriver;frxDB18;AnyDAC_ComI_D18;AnyDAC_PhysTDBX_D18;fmx;IndySystem;frx18;TeeDB;AnyDAC_PhysIB_D18;inetdbbde;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DCLFMXTee_LiveBindings;DataSnapProviderClient;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;AnyDAC_PhysMSAcc_D18;FMXTeePro918;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;AnyDAC_PhysPg_D18;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;AnyDAC_PhysMSSQL_D18;AnyDAC_PhysOracle_D18;inetdbxpress;webdsnap;AnyDAC_PhysMySQL_D18;adortl;AnyDAC_Phys_D18;AnyDAC_Comp_D18;bindcompfmx;vcldbx;FmxTeeUI918;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;Tee;DBXOdbcDriver;xmlrtl;svnui;ibxpress;IndyProtocols;DBXMySQLDriver;frxe18;DCLVCLTee_LiveBindings;vclactnband;bindengine;soaprtl;bindcompdbx;FMXTee;bindcompvcl;vclie;FMXTeeLanguage918;vcltouch;AnyDAC_PhysASA_D18;VclSmp;DBXInformixDriver;Intraweb;DataSnapConnectors;dsnapcon;DBXFirebirdDriver;AnyDAC_PhysSQLITE_D18;inet;FMXTee918;fmxobj;vclx;svn;DBXSybaseASADriver;fmxdae;bdertl;dbexpress;FMXTeeDB918;DataSnapIndy10ServerTransport;AnyDAC_PhysDb2_D18;$(DCC_UsePackage)
64 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
65 | true
66 | 1033
67 | $(BDS)\bin\default_app.manifest
68 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
69 |
70 |
71 | IndyIPClient;AnyDAC_PhysADS_D18;AnyDAC_PhysODBC_D18;AnyDAC_GUIxForms_D18;DBXSqliteDriver;AnyDAC_ComI_D18;AnyDAC_PhysTDBX_D18;fmx;IndySystem;TeeDB;AnyDAC_PhysIB_D18;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;AnyDAC_PhysMSAcc_D18;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;AnyDAC_PhysPg_D18;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;AnyDAC_PhysMSSQL_D18;AnyDAC_PhysOracle_D18;inetdbxpress;webdsnap;AnyDAC_PhysMySQL_D18;adortl;AnyDAC_Phys_D18;AnyDAC_Comp_D18;bindcompfmx;rtl;dbrtl;DbxClientDriver;bindcomp;inetdb;Tee;DBXOdbcDriver;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;vclactnband;bindengine;soaprtl;bindcompdbx;FMXTee;bindcompvcl;vclie;vcltouch;AnyDAC_PhysASA_D18;VclSmp;DBXInformixDriver;Intraweb;DataSnapConnectors;dsnapcon;DBXFirebirdDriver;AnyDAC_PhysSQLITE_D18;inet;fmxobj;vclx;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;AnyDAC_PhysDb2_D18;$(DCC_UsePackage)
72 |
73 |
74 | DEBUG;$(DCC_Define)
75 | true
76 | false
77 | true
78 | true
79 | true
80 |
81 |
82 | false
83 |
84 |
85 | false
86 | RELEASE;$(DCC_Define)
87 | 0
88 | 0
89 |
90 |
91 |
92 | MainSource
93 |
94 |
95 |
96 | fmx
97 |
98 |
99 | Cfg_2
100 | Base
101 |
102 |
103 | Base
104 |
105 |
106 | Cfg_1
107 | Base
108 |
109 |
110 |
111 | Delphi.Personality.12
112 |
113 |
114 |
115 |
116 | False
117 | False
118 | 1
119 | 0
120 | 0
121 | 0
122 | False
123 | False
124 | False
125 | False
126 | False
127 | 1033
128 | 1252
129 |
130 |
131 |
132 |
133 | 1.0.0.0
134 |
135 |
136 |
137 |
138 |
139 | 1.0.0.0
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | IntToBool.dpr
158 |
159 |
160 |
161 |
162 | False
163 | True
164 | False
165 |
166 |
167 | 12
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/LiveBindings/Treating an Integer as a Boolean/Unit13.fmx:
--------------------------------------------------------------------------------
1 | object Form13: TForm13
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form13'
5 | ClientHeight = 327
6 | ClientWidth = 289
7 | FormFactor.Width = 320
8 | FormFactor.Height = 480
9 | FormFactor.Devices = [dkDesktop, dkiPhone, dkiPad]
10 | OnShow = FormShow
11 | DesignerMobile = False
12 | DesignerWidth = 0
13 | DesignerHeight = 0
14 | DesignerDeviceName = ''
15 | DesignerOrientation = 0
16 | DesignerOSVersion = ''
17 | object Grid1: TGrid
18 | Height = 249.000000000000000000
19 | Position.X = 16.000000000000000000
20 | Position.Y = 56.000000000000000000
21 | TabOrder = 0
22 | Width = 257.000000000000000000
23 | RowCount = 0
24 | RowHeight = 21.000000000000000000
25 | end
26 | object NavigatorBindSourceDB1: TBindNavigator
27 | Height = 33.000000000000000000
28 | Position.X = 16.000000000000000000
29 | Position.Y = 8.000000000000000000
30 | Width = 260.000000000000000000
31 | DataSource = BindSourceDB1
32 | xRadius = 4.000000000000000000
33 | yRadius = 4.000000000000000000
34 | end
35 | object ClientDataSet1: TClientDataSet
36 | Aggregates = <>
37 | FieldDefs = <
38 | item
39 | Name = 'IntegerField'
40 | DataType = ftSmallint
41 | end>
42 | IndexDefs = <>
43 | Params = <>
44 | StoreDefs = True
45 | Left = 48
46 | Top = 128
47 | object ClientDataSet1IntegerField: TSmallintField
48 | DefaultExpression = '1'
49 | FieldName = 'IntegerField'
50 | end
51 | end
52 | object BindSourceDB1: TBindSourceDB
53 | DataSet = ClientDataSet1
54 | ScopeMappings = <>
55 | Left = 136
56 | Top = 128
57 | end
58 | object BindingsList1: TBindingsList
59 | Methods = <>
60 | OutputConverters = <>
61 | Left = 52
62 | Top = 197
63 | object LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource
64 | Category = 'Quick Bindings'
65 | DataSource = BindSourceDB1
66 | GridControl = Grid1
67 | AutoBufferCount = False
68 | Columns = <
69 | item
70 | MemberName = 'IntegerField'
71 | Width = 80
72 | CustomFormat = 'ToStr(%s) <> "0"'
73 | CustomParse = 'IfThen(ToStr(%s) = "True", -1, 0)'
74 | ColumnStyle = 'CheckColumn'
75 | end
76 | item
77 | MemberName = 'IntegerField'
78 | Header = 'IntegerField (Raw)'
79 | Width = 100
80 | end>
81 | end
82 | end
83 | end
84 |
--------------------------------------------------------------------------------
/LiveBindings/Treating an Integer as a Boolean/Unit13.pas:
--------------------------------------------------------------------------------
1 | unit Unit13;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
7 | System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
8 | FMX.StdCtrls, Data.DB, Datasnap.DBClient, Data.Bind.EngExt, Fmx.Bind.DBEngExt,
9 | Fmx.Bind.Grid, System.Bindings.Outputs, Fmx.Bind.Editors,
10 | Data.Bind.Components, Data.Bind.Grid, FMX.Layouts, Fmx.Bind.Navigator,
11 | FMX.Grid, Data.Bind.DBScope;
12 |
13 | type
14 | TForm13 = class(TForm)
15 | ClientDataSet1: TClientDataSet;
16 | BindSourceDB1: TBindSourceDB;
17 | Grid1: TGrid;
18 | NavigatorBindSourceDB1: TBindNavigator;
19 | BindingsList1: TBindingsList;
20 | LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource;
21 | ClientDataSet1IntegerField: TSmallintField;
22 | procedure FormShow(Sender: TObject);
23 | private
24 | { Private declarations }
25 | public
26 | { Public declarations }
27 | end;
28 |
29 | var
30 | Form13: TForm13;
31 |
32 | implementation
33 |
34 | {$R *.fmx}
35 |
36 | procedure TForm13.FormShow(Sender: TObject);
37 | begin
38 | ClientDataSet1.CreateDataSet;
39 | end;
40 |
41 | end.
42 |
--------------------------------------------------------------------------------
/LiveBindings/Treating an Integer as a Boolean/Unit13.vlb:
--------------------------------------------------------------------------------
1 | [ClientDataSet1]
2 | Coordinates=200,60,106,116
3 | Visible=False
4 |
5 | [BindSourceDB1]
6 | Coordinates=200,60,106,116
7 |
8 | [Grid1]
9 | Coordinates=380,80,63,102
10 |
11 | [BindingsList1]
12 | Coordinates=111,1,82,33
13 |
14 | []
15 | Coordinates=131,97,59,58
16 | Visible=False
17 |
18 | [ClientDataSet1IntegerField]
19 | Coordinates=418,105,156,33
20 |
21 |
--------------------------------------------------------------------------------
/LiveBindings/Updating objects through an Adapter/UpdatingObjectsThroughAnAdapter.dpr:
--------------------------------------------------------------------------------
1 | program UpdatingObjectsThroughAnAdapter;
2 |
3 | uses
4 | FMX.Forms,
5 | fMain in 'fMain.pas' {Form1};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.CreateForm(TForm1, Form1);
12 | Application.Run;
13 | end.
14 |
--------------------------------------------------------------------------------
/LiveBindings/Updating objects through an Adapter/UpdatingObjectsThroughAnAdapter.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {B86ACB6E-5F66-48B6-8978-4EF12A2DAB38}
4 | 14.3
5 | FMX
6 | UpdatingObjectsThroughAnAdapter.dpr
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | $(BDS)\bin\delphi_PROJECTICON.ico
49 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
50 | .\$(Platform)\$(Config)
51 | .\$(Platform)\$(Config)
52 | false
53 | false
54 | false
55 | false
56 | false
57 |
58 |
59 | bindcompfmx;DBXSqliteDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;dbxcds;DBXMySQLDriver;bindengine;soaprtl;bindcompdbx;DBXOracleDriver;CustomIPTransport;dsnap;IndyIPServer;DBXInformixDriver;fmxase;IndyCore;IndyIPCommon;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
60 |
61 |
62 | fs17;frx17;bindcompfmx;DBXSqliteDriver;vcldbx;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;TeeDB;bindcomp;inetdb;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;DataSnapProviderClient;xmlrtl;svnui;ibxpress;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;MetropolisUILiveTile;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;Intraweb;fmxase;vcl;IndyCore;DataSnapConnectors;IndyIPCommon;CloudService;DBXMSSQLDriver;dsnapcon;DBXFirebirdDriver;FmxTeeUI;inet;fsDB17;fmxobj;frxDB17;CodeSiteExpressPkg;vclx;frxe17;inetdbxpress;webdsnap;svn;DBXSybaseASADriver;fmxdae;bdertl;dbexpress;adortl;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
63 | $(BDS)\bin\default_app.manifest
64 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
65 | 1033
66 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
67 | true
68 |
69 |
70 | bindcompfmx;DBXSqliteDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;fmxase;vcl;IndyCore;IndyIPCommon;DBXMSSQLDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;vclx;inetdbxpress;webdsnap;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
71 |
72 |
73 | DEBUG;$(DCC_Define)
74 | true
75 | false
76 | true
77 | true
78 | true
79 |
80 |
81 | false
82 |
83 |
84 | false
85 | RELEASE;$(DCC_Define)
86 | 0
87 | false
88 |
89 |
90 |
91 | MainSource
92 |
93 |
94 |
95 | fmx
96 |
97 |
98 | Cfg_2
99 | Base
100 |
101 |
102 | Base
103 |
104 |
105 | Cfg_1
106 | Base
107 |
108 |
109 |
110 | Delphi.Personality.12
111 |
112 |
113 |
114 |
115 | False
116 | False
117 | 1
118 | 0
119 | 0
120 | 0
121 | False
122 | False
123 | False
124 | False
125 | False
126 | 1033
127 | 1252
128 |
129 |
130 |
131 |
132 | 1.0.0.0
133 |
134 |
135 |
136 |
137 |
138 | 1.0.0.0
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | UpdatingObjectsThroughAnAdapter.dpr
151 |
152 |
153 |
154 |
155 | False
156 | True
157 | False
158 |
159 | False
160 |
161 | 12
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/LiveBindings/Updating objects through an Adapter/UpdatingObjectsThroughAnAdapter.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/LiveBindings/Updating objects through an Adapter/UpdatingObjectsThroughAnAdapter.res
--------------------------------------------------------------------------------
/LiveBindings/Updating objects through an Adapter/fMain.fmx:
--------------------------------------------------------------------------------
1 | object Form1: TForm1
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form1'
5 | ClientHeight = 441
6 | ClientWidth = 375
7 | FormFactor.Width = 1920
8 | FormFactor.Height = 1080
9 | FormFactor.Devices = [dkDesktop]
10 | object NavigatorAdapterBindSource1: TBindNavigator
11 | Height = 25.000000000000000000
12 | Position.X = 24.000000000000000000
13 | Position.Y = 16.000000000000000000
14 | Width = 241.000000000000000000
15 | DataSource = AdapterBindSource1
16 | xRadius = 4.000000000000000000
17 | yRadius = 4.000000000000000000
18 | end
19 | object GroupBox1: TGroupBox
20 | Height = 121.000000000000000000
21 | Position.X = 24.000000000000000000
22 | Position.Y = 56.000000000000000000
23 | Text = 'Values via LiveBindings'
24 | Width = 329.000000000000000000
25 | object EditFirstname: TEdit
26 | DisableFocusEffect = False
27 | KeyboardType = vktDefault
28 | Password = False
29 | Text = 'ipsum mi vehicula purus'
30 | Position.X = 80.000000000000000000
31 | Position.Y = 24.000000000000000000
32 | Width = 153.000000000000000000
33 | Height = 22.000000000000000000
34 | object Label1: TLabel
35 | Height = 15.000000000000000000
36 | Position.X = -64.000000000000000000
37 | Position.Y = 2.000000000000000000
38 | Text = 'Firstname'
39 | Width = 120.000000000000000000
40 | WordWrap = False
41 | end
42 | end
43 | object EditLastname: TEdit
44 | DisableFocusEffect = False
45 | KeyboardType = vktDefault
46 | Password = False
47 | Text = 'ipsum mi vehicula purus'
48 | Position.X = 80.000000000000000000
49 | Position.Y = 54.000000000000000000
50 | Width = 153.000000000000000000
51 | Height = 22.000000000000000000
52 | object Label2: TLabel
53 | Height = 15.000000000000000000
54 | Position.X = -64.000000000000000000
55 | Position.Y = 2.000000000000000000
56 | Text = 'Lastname'
57 | Width = 120.000000000000000000
58 | WordWrap = False
59 | end
60 | end
61 | object EditAge: TEdit
62 | DisableFocusEffect = False
63 | KeyboardType = vktDefault
64 | Password = False
65 | Text = '-33'
66 | Position.X = 80.000000000000000000
67 | Position.Y = 86.000000000000000000
68 | Width = 100.000000000000000000
69 | Height = 22.000000000000000000
70 | object Label3: TLabel
71 | Height = 15.000000000000000000
72 | Position.X = -64.000000000000000000
73 | Position.Y = 2.000000000000000000
74 | Text = 'Age'
75 | Width = 120.000000000000000000
76 | WordWrap = False
77 | end
78 | end
79 | end
80 | object GroupBox2: TGroupBox
81 | Height = 121.000000000000000000
82 | Position.X = 24.000000000000000000
83 | Position.Y = 304.000000000000000000
84 | Text = 'Values from Object'
85 | Width = 329.000000000000000000
86 | object Label6: TLabel
87 | Height = 15.000000000000000000
88 | Position.X = 16.000000000000000000
89 | Position.Y = 59.000000000000000000
90 | Text = 'Lastname'
91 | Width = 120.000000000000000000
92 | end
93 | object Label4: TLabel
94 | Height = 15.000000000000000000
95 | Position.X = 16.000000000000000000
96 | Position.Y = 24.000000000000000000
97 | Text = 'Firstname'
98 | Width = 120.000000000000000000
99 | end
100 | object Label5: TLabel
101 | Height = 15.000000000000000000
102 | Position.X = 16.000000000000000000
103 | Position.Y = 95.000000000000000000
104 | Text = 'Age'
105 | Width = 120.000000000000000000
106 | end
107 | object lblObjectFirstname: TLabel
108 | Height = 15.000000000000000000
109 | Position.X = 80.000000000000000000
110 | Position.Y = 24.000000000000000000
111 | Text = 'lblObjectFirstname'
112 | Width = 120.000000000000000000
113 | end
114 | object lblObjectLastname: TLabel
115 | Height = 15.000000000000000000
116 | Position.X = 80.000000000000000000
117 | Position.Y = 61.000000000000000000
118 | Text = 'lblObjectLastname'
119 | Width = 120.000000000000000000
120 | end
121 | object lblObjectAge: TLabel
122 | Height = 15.000000000000000000
123 | Position.X = 80.000000000000000000
124 | Position.Y = 95.000000000000000000
125 | Text = 'lblObjectAge'
126 | Width = 120.000000000000000000
127 | end
128 | end
129 | object GroupBox3: TGroupBox
130 | Height = 129.000000000000000000
131 | Position.X = 24.000000000000000000
132 | Position.Y = 176.000000000000000000
133 | Text = 'Values from AdapterBindSource.InternalAdapter'
134 | Width = 329.000000000000000000
135 | object Label10: TLabel
136 | Height = 15.000000000000000000
137 | Position.X = 16.000000000000000000
138 | Position.Y = 32.000000000000000000
139 | Text = 'Firstname'
140 | Width = 120.000000000000000000
141 | end
142 | object Label11: TLabel
143 | Height = 15.000000000000000000
144 | Position.X = 16.000000000000000000
145 | Position.Y = 64.000000000000000000
146 | Text = 'Lastname'
147 | Width = 120.000000000000000000
148 | end
149 | object Label12: TLabel
150 | Height = 15.000000000000000000
151 | Position.X = 16.000000000000000000
152 | Position.Y = 96.000000000000000000
153 | Text = 'Age'
154 | Width = 120.000000000000000000
155 | end
156 | object lblAdapterFirstname: TLabel
157 | Height = 15.000000000000000000
158 | Position.X = 80.000000000000000000
159 | Position.Y = 32.000000000000000000
160 | Text = 'lblAdapterFirstname'
161 | Width = 120.000000000000000000
162 | end
163 | object lblAdapterLastname: TLabel
164 | Height = 15.000000000000000000
165 | Position.X = 80.000000000000000000
166 | Position.Y = 64.000000000000000000
167 | Text = 'lblAdapterLastname'
168 | Width = 120.000000000000000000
169 | end
170 | object lblAdapterAge: TLabel
171 | Height = 15.000000000000000000
172 | Position.X = 80.000000000000000000
173 | Position.Y = 96.000000000000000000
174 | Text = 'lblAdapterAge'
175 | Width = 120.000000000000000000
176 | end
177 | end
178 | object Button1: TButton
179 | DisableFocusEffect = False
180 | Height = 22.000000000000000000
181 | Position.X = 272.000000000000000000
182 | Position.Y = 16.000000000000000000
183 | Text = 'Refresh'
184 | Width = 80.000000000000000000
185 | OnClick = Button1Click
186 | end
187 | object AdapterBindSource1: TAdapterBindSource
188 | AutoActivate = True
189 | OnCreateAdapter = AdapterBindSource1CreateAdapter
190 | Adapter = DataGeneratorAdapter1
191 | ScopeMappings = <>
192 | Left = 48
193 | Top = 16
194 | end
195 | object DataGeneratorAdapter1: TDataGeneratorAdapter
196 | FieldDefs = <
197 | item
198 | Name = 'Firstname'
199 | Generator = 'LoremIpsum'
200 | ReadOnly = False
201 | end
202 | item
203 | Name = 'Lastname'
204 | Generator = 'LoremIpsum'
205 | ReadOnly = False
206 | end
207 | item
208 | Name = 'Age'
209 | FieldType = ftInteger
210 | Generator = 'Integers'
211 | ReadOnly = False
212 | end>
213 | Active = True
214 | Options = [loptAllowInsert, loptAllowDelete, loptAllowModify]
215 | Left = 104
216 | Top = 16
217 | end
218 | object BindingsList1: TBindingsList
219 | Methods = <>
220 | OutputConverters = <>
221 | UseAppManager = True
222 | Left = 156
223 | Top = 13
224 | object LinkGridToDataSource1: TLinkGridToDataSource
225 | Category = 'Quick Bindings'
226 | DataSource = AdapterBindSource1
227 | AutoBufferCount = False
228 | Columns = <>
229 | end
230 | object LinkControlToField1: TLinkControlToField
231 | Category = 'Quick Bindings'
232 | DataSource = AdapterBindSource1
233 | FieldName = 'Firstname'
234 | Control = EditFirstname
235 | Track = False
236 | end
237 | object LinkControlToField4: TLinkControlToField
238 | Category = 'Quick Bindings'
239 | DataSource = AdapterBindSource1
240 | FieldName = 'Lastname'
241 | Control = EditLastname
242 | Track = False
243 | end
244 | object LinkControlToField5: TLinkControlToField
245 | Category = 'Quick Bindings'
246 | DataSource = AdapterBindSource1
247 | FieldName = 'Age'
248 | Control = EditAge
249 | Track = False
250 | end
251 | end
252 | end
253 |
--------------------------------------------------------------------------------
/LiveBindings/Updating objects through an Adapter/fMain.pas:
--------------------------------------------------------------------------------
1 | unit fMain;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
7 | System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
8 | Data.Bind.GenData, System.Bindings.Outputs, Fmx.Bind.Editors,
9 | Data.Bind.EngExt, Fmx.Bind.DBEngExt, Data.Bind.Components, FMX.Edit,
10 | Data.Bind.Grid, FMX.Layouts, Fmx.Bind.Navigator, Data.Bind.ObjectScope;
11 |
12 | type
13 | TPerson = class
14 | private
15 | FAge: Integer;
16 | FLastname: string;
17 | FFirstname: string;
18 | public
19 | constructor Create(const Firstname, Lastname : string; Age : Integer);
20 | property Firstname : string read FFirstname write FFirstname;
21 | property Lastname : string read FLastname write FLastname;
22 | property Age : Integer read FAge write FAge;
23 | end;
24 |
25 | TForm1 = class(TForm)
26 | AdapterBindSource1: TAdapterBindSource;
27 | DataGeneratorAdapter1: TDataGeneratorAdapter;
28 | NavigatorAdapterBindSource1: TBindNavigator;
29 | LinkGridToDataSource1: TLinkGridToDataSource;
30 | BindingsList1: TBindingsList;
31 | EditFirstname: TEdit;
32 | Label1: TLabel;
33 | LinkControlToField1: TLinkControlToField;
34 | GroupBox1: TGroupBox;
35 | GroupBox2: TGroupBox;
36 | EditLastname: TEdit;
37 | Label2: TLabel;
38 | LinkControlToField4: TLinkControlToField;
39 | EditAge: TEdit;
40 | Label3: TLabel;
41 | LinkControlToField5: TLinkControlToField;
42 | Label4: TLabel;
43 | Label5: TLabel;
44 | Label6: TLabel;
45 | Button1: TButton;
46 | GroupBox3: TGroupBox;
47 | lblObjectFirstname: TLabel;
48 | lblObjectLastname: TLabel;
49 | lblObjectAge: TLabel;
50 | Label10: TLabel;
51 | Label11: TLabel;
52 | Label12: TLabel;
53 | lblAdapterFirstname: TLabel;
54 | lblAdapterLastname: TLabel;
55 | lblAdapterAge: TLabel;
56 | procedure AdapterBindSource1CreateAdapter(Sender: TObject;
57 | var ABindSourceAdapter: TBindSourceAdapter);
58 | procedure Button1Click(Sender: TObject);
59 | private
60 | { Private declarations }
61 | FPerson : TPerson;
62 | public
63 | { Public declarations }
64 | end;
65 |
66 | var
67 | Form1: TForm1;
68 |
69 | implementation
70 |
71 | {$R *.fmx}
72 |
73 | constructor TPerson.Create(const Firstname, Lastname: string; Age : Integer);
74 | begin
75 | FFirstname := Firstname;
76 | FLastname := Lastname;
77 | FAge := Age;
78 | end;
79 |
80 |
81 |
82 | procedure TForm1.AdapterBindSource1CreateAdapter(Sender: TObject;
83 | var ABindSourceAdapter: TBindSourceAdapter);
84 | begin
85 | FPerson := TPerson.Create('Fred', 'Flintstone', 42);
86 | ABindSourceAdapter := TObjectBindSourceAdapter.Create(AdapterBindSource1,
87 | FPerson);
88 | end;
89 |
90 | procedure TForm1.Button1Click(Sender: TObject);
91 | var
92 | Adapter : TBindSourceAdapter;
93 | begin
94 | lblObjectFirstname.Text := FPerson.Firstname;
95 | lblObjectLastname.Text := FPerson.Lastname;
96 | lblObjectAge.Text := IntToStr(FPerson.Age);
97 |
98 | Adapter := AdapterBindSource1.InternalAdapter;
99 | lblAdapterFirstname.Text := Adapter.FindField('Firstname').GetTValue.ToString;
100 | lblAdapterLastname.Text := Adapter.FindField('Lastname').GetTValue.ToString;
101 | lblAdapterAge.Text := Adapter.FindField('Age').GetTValue.ToString;
102 | end;
103 |
104 | end.
105 |
--------------------------------------------------------------------------------
/LiveBindings/Updating objects through an Adapter/fMain.vlb:
--------------------------------------------------------------------------------
1 | [DataGeneratorAdapter1]
2 | Visible=False
3 | Coordinates=10,10,138,146
4 |
5 | [AdapterBindSource1]
6 | Coordinates=10,10,138,146
7 |
8 | [EditFirstname]
9 | Coordinates=167,78,94,58
10 |
11 | [Label1]
12 | Coordinates=167,155,53,58
13 |
14 | []
15 | Coordinates=299,285,127,58
16 |
17 | [GroupBox1]
18 | Coordinates=78,189,79,58
19 |
20 | [GroupBox2]
21 | Coordinates=454,1,79,58
22 |
23 | [EditLastname]
24 | Coordinates=167,1,93,58
25 |
26 | [Label2]
27 | Coordinates=19,175,53,58
28 |
29 | [EditAge]
30 | Coordinates=299,131,60,58
31 |
32 | [Label3]
33 | Coordinates=299,208,53,58
34 |
35 | [Label4]
36 | Coordinates=240,285,53,58
37 |
38 | [Label5]
39 | Coordinates=83,285,53,58
40 |
41 | [Label6]
42 | Coordinates=24,285,53,58
43 |
44 | [Button1]
45 | Coordinates=454,78,59,58
46 |
47 | [GroupBox3]
48 | Coordinates=454,155,79,58
49 |
50 | [Label10]
51 | Coordinates=454,309,60,58
52 |
53 | [Label11]
54 | Coordinates=435,381,60,58
55 |
56 | [Label12]
57 | Coordinates=366,381,60,58
58 |
59 | [lblObjectFirstname]
60 | Coordinates=299,285,122,58
61 |
62 | [lblObjectLastname]
63 | Coordinates=181,285,121,58
64 |
65 | [lblObjectAge]
66 | Coordinates=454,232,88,58
67 |
68 | [lblAdapterFirstname]
69 | Coordinates=297,381,130,58
70 |
71 | [lblAdapterLastname]
72 | Coordinates=228,381,129,58
73 |
74 | [lblAdapterAge]
75 | Coordinates=159,381,95,58
76 |
77 |
--------------------------------------------------------------------------------
/OpenDocument/OpenDocument.deployproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 12
5 |
6 |
7 |
8 |
9 | OpenDocument.app\Contents\
10 | Info.plist
11 | 1
12 |
13 |
14 |
15 |
16 | OpenDocument.app\Contents\MacOS\
17 | OpenDocument
18 | 1
19 |
20 |
21 | True
22 |
23 |
24 | OpenDocument.app\Contents\MacOS\
25 | libcgunwind.1.0.dylib
26 | 1
27 |
28 |
29 |
30 |
31 | OpenDocument.app\Contents\MacOS\
32 | OpenDocument.rsm
33 | 1
34 |
35 |
36 |
37 |
38 | OpenDocument.app\Contents\Resources\
39 | OpenDocument.icns
40 | 1
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/OpenDocument/OpenDocument.dpr:
--------------------------------------------------------------------------------
1 | program OpenDocument;
2 |
3 | uses
4 | FMX.Forms,
5 | fMain in 'fMain.pas' {Form2};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | ReportMemoryLeaksOnShutdown := True;
11 | Application.Initialize;
12 | Application.CreateForm(TForm2, Form2);
13 | Application.Run;
14 | end.
15 |
--------------------------------------------------------------------------------
/OpenDocument/OpenDocument.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {C5661B5A-64E9-4031-8CE4-6359B73D7119}
4 | 13.4
5 | FMX
6 | OpenDocument.dpr
7 | True
8 | Debug
9 | OSX32
10 | 5
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;dsnap;DBXInformixDriver;IndyCore;fmxase;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IPIndyImpl;$(DCC_UsePackage)
49 | $(BDS)\bin\delphi_PROJECTICON.ico
50 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
51 | .\$(Platform)\$(Config)
52 | .\$(Platform)\$(Config)
53 | false
54 | false
55 | false
56 | false
57 | false
58 |
59 |
60 | DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage)
61 |
62 |
63 | true
64 | CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName)
65 |
66 |
67 | vcldbx;TeeDB;vclib;inetdbbde;Tee;DBXOdbcDriver;svnui;ibxpress;DBXSybaseASEDriver;vclimg;intrawebdb_120_160;fmi;vclactnband;FMXTee;vcldb;TeeUI;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;VclSmp;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage)
68 | true
69 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
70 | 1033
71 | $(BDS)\bin\default_app.manifest
72 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
73 |
74 |
75 | DEBUG;$(DCC_Define)
76 | false
77 | true
78 | true
79 | true
80 |
81 |
82 | false
83 |
84 |
85 | false
86 | RELEASE;$(DCC_Define)
87 | 0
88 | false
89 |
90 |
91 |
92 | MainSource
93 |
94 |
95 |
96 | fmx
97 |
98 |
99 | Cfg_2
100 | Base
101 |
102 |
103 | Base
104 |
105 |
106 | Cfg_1
107 | Base
108 |
109 |
110 |
111 | Delphi.Personality.12
112 |
113 |
114 |
115 |
116 | False
117 | False
118 | 1
119 | 0
120 | 0
121 | 0
122 | False
123 | False
124 | False
125 | False
126 | False
127 | 1033
128 | 1252
129 |
130 |
131 |
132 |
133 | 1.0.0.0
134 |
135 |
136 |
137 |
138 |
139 | 1.0.0.0
140 |
141 |
142 |
143 | OpenDocument.dpr
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 | Contents\MacOS\
159 | OpenDocument.rsm
160 |
161 |
162 |
163 |
164 | Info.plist
165 |
166 |
167 |
168 |
169 | Contents\MacOS
170 | 1
171 |
172 |
173 | 0
174 |
175 |
176 |
177 |
178 | Contents\MacOS
179 | 1
180 | .dylib
181 |
182 |
183 | 0
184 | .bpl
185 |
186 |
187 |
188 |
189 | Contents\MacOS
190 | 1
191 | .dylib
192 |
193 |
194 | 0
195 | .dll;.bpl
196 |
197 |
198 |
199 |
200 | Contents
201 | 1
202 |
203 |
204 |
205 |
206 | Contents\MacOS
207 | 0
208 |
209 |
210 | 0
211 |
212 |
213 |
214 |
215 | Contents\MacOS
216 | 1
217 |
218 |
219 | 0
220 |
221 |
222 |
223 |
224 | Contents\MacOS
225 | 1
226 | .framework
227 |
228 |
229 | 0
230 |
231 |
232 |
233 |
234 | Contents\MacOS
235 | 1
236 |
237 |
238 | 0
239 |
240 |
241 |
242 |
243 | Contents\Resources
244 | 1
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 | False
253 | True
254 | True
255 |
256 |
257 | 12
258 |
259 |
260 |
261 |
262 |
263 |
--------------------------------------------------------------------------------
/OpenDocument/OpenDocument.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/OpenDocument/OpenDocument.res
--------------------------------------------------------------------------------
/OpenDocument/fMain.fmx:
--------------------------------------------------------------------------------
1 | object Form2: TForm2
2 | Left = 0
3 | Top = 0
4 | Caption = 'Form2'
5 | ClientHeight = 158
6 | ClientWidth = 460
7 | Visible = False
8 | StyleLookup = 'backgroundstyle'
9 | object Button1: TButton
10 | Position.Point = '(368,24)'
11 | Width = 80.000000000000000000
12 | Height = 22.000000000000000000
13 | OnClick = Button1Click
14 | TabOrder = 0
15 | Text = 'Open File'
16 | end
17 | object Button2: TButton
18 | Position.Point = '(368,56)'
19 | Width = 80.000000000000000000
20 | Height = 22.000000000000000000
21 | OnClick = Button2Click
22 | TabOrder = 1
23 | Text = 'Send Email'
24 | end
25 | object Label1: TLabel
26 | Position.Point = '(16,24)'
27 | Width = 345.000000000000000000
28 | Height = 57.000000000000000000
29 | TabOrder = 2
30 | VertTextAlign = taLeading
31 | Text = 'Label1'
32 | end
33 | object Button3: TButton
34 | Position.Point = '(368,88)'
35 | Width = 80.000000000000000000
36 | Height = 22.000000000000000000
37 | OnClick = Button3Click
38 | TabOrder = 3
39 | Text = 'Open Browser'
40 | end
41 | object OpenDialog1: TOpenDialog
42 | Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
43 | Left = 16
44 | Top = 112
45 | end
46 | object edtURL: TEdit
47 | Position.Point = '(16,88)'
48 | Width = 345.000000000000000000
49 | Height = 22.000000000000000000
50 | TabOrder = 4
51 | KeyboardType = vktDefault
52 | Password = False
53 | Text = 'http://www.malcolmgroves.com/test page.html'
54 | end
55 | end
56 |
--------------------------------------------------------------------------------
/OpenDocument/fMain.pas:
--------------------------------------------------------------------------------
1 | unit fMain;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Edit;
8 |
9 | type
10 | TForm2 = class(TForm)
11 | Button1: TButton;
12 | Button2: TButton;
13 | OpenDialog1: TOpenDialog;
14 | Label1: TLabel;
15 | Button3: TButton;
16 | edtURL: TEdit;
17 | procedure Button1Click(Sender: TObject);
18 | procedure Button2Click(Sender: TObject);
19 | procedure Button3Click(Sender: TObject);
20 | private
21 | { Private declarations }
22 | public
23 | { Public declarations }
24 | end;
25 |
26 | var
27 | Form2: TForm2;
28 |
29 | implementation
30 | uses
31 | Macapi.Foundation, Macapi.AppKit, idURI;
32 |
33 | {$R *.fmx}
34 |
35 | procedure TForm2.Button1Click(Sender: TObject);
36 | var
37 | Workspace : NSWorkspace;
38 | begin
39 | if OpenDialog1.Execute then
40 | begin
41 | Label1.Text := OpenDialog1.FileName;
42 | Workspace := TNSWorkspace.Create;
43 | Workspace.openFile(NSSTR(Label1.Text));
44 | end;
45 | end;
46 |
47 | procedure TForm2.Button2Click(Sender: TObject);
48 | var
49 | URL : NSURL;
50 | Workspace : NSWorkspace;
51 | begin
52 | URL := TNSURL.Create;
53 | URL.initWithString(NSSTR('mailto:fred@flintstones.com?subject=Hello&body=Hello%20Fred'));
54 |
55 | Workspace := TNSWorkspace.Create;
56 | Workspace.openURL(URL);
57 | end;
58 |
59 | procedure TForm2.Button3Click(Sender: TObject);
60 | var
61 | EncodedString : String;
62 | URL : NSURL;
63 | Workspace : NSWorkspace;
64 | begin
65 | EncodedString := TIdURI.URLEncode(edtURL.Text);
66 |
67 | URL := TNSURL.Create;
68 | URL.initWithString(NSSTR(EncodedString));
69 |
70 | Workspace := TNSWorkspace.Create;
71 | Workspace.openURL(URL);
72 | end;
73 |
74 | end.
75 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | What's in delphi-samples?
2 | =========================
3 | Sample source from conference presentations and also tutorials on www.malcolmgroves.com
4 |
5 |
6 | GenericCollections
7 | ------------------
8 | Sample source from my Introduction to Generic Collections in Delphi session
9 |
10 | OpenDocument
11 | ------------
12 | Delphi FireMonkey application for OSX that shows how to open files and URLs in default applications. [More info](http://www.malcolmgroves.com/blog/?p=887)
13 |
14 | SpecialFolders
15 | --------------
16 | Delphi FireMonkey application for OSX and Windows that shows how to find "Special Folders" (ie. OS folders like Documents, Desktop, etc) and enumerate the contents in a cross-platform fashion. [More info](http://www.malcolmgroves.com/blog/?p=865)
17 |
18 | LiveBindings
19 | ------------
20 | Samples from the series of LiveBinding in XE3 posts on my blog. [More info](http://www.malcolmgroves.com/blog/?tag=livebindings)
21 |
22 |
--------------------------------------------------------------------------------
/SpecialFolders/DocumentDirectory.dpr:
--------------------------------------------------------------------------------
1 | program DocumentDirectory;
2 |
3 | uses
4 | FMX.Forms,
5 | fMain in 'fMain.pas' {Form2};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.CreateForm(TForm2, Form2);
12 | Application.Run;
13 | end.
14 |
--------------------------------------------------------------------------------
/SpecialFolders/DocumentDirectory.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {6D26C5AC-94DF-47E6-B7CA-A6838455EEA7}
4 | 14.3
5 | FMX
6 | DocumentDirectory.dpr
7 | True
8 | Debug
9 | OSX32
10 | 5
11 | Application
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Cfg_1
39 | true
40 | true
41 |
42 |
43 | true
44 | Base
45 | true
46 |
47 |
48 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
49 | $(BDS)\bin\delphi_PROJECTICON.ico
50 | .\$(Platform)\$(Config)
51 | .\$(Platform)\$(Config)
52 | false
53 | false
54 | false
55 | false
56 | false
57 |
58 |
59 | true
60 | bindcompfmx;DBXSqliteDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;dbxcds;DBXMySQLDriver;bindengine;soaprtl;bindcompdbx;DBXOracleDriver;CustomIPTransport;dsnap;IndyIPServer;DBXInformixDriver;fmxase;IndyCore;IndyIPCommon;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
61 | CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities
62 |
63 |
64 | $(BDS)\bin\default_app.manifest
65 | bindcompfmx;DBXSqliteDriver;vcldbx;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;TeeDB;bindcomp;inetdb;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;Tee;DataSnapProviderClient;xmlrtl;svnui;ibxpress;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;MetropolisUILiveTile;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;FMXTee;TeeUI;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;vclribbon;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;Intraweb;fmxase;vcl;IndyCore;DataSnapConnectors;CodeSiteExpressPkg;IndyIPCommon;CloudService;dsnapcon;DBXFirebirdDriver;DBXMSSQLDriver;inet;FmxTeeUI;fmxobj;vclx;inetdbxpress;webdsnap;svn;DBXSybaseASADriver;fmxdae;bdertl;SampleAdapterPackage;dbexpress;adortl;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
66 | true
67 | 1033
68 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
69 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
70 |
71 |
72 | bindcompfmx;DBXSqliteDriver;fmx;rtl;dbrtl;DbxClientDriver;IndySystem;bindcomp;inetdb;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DBXOdbcDriver;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;DBXSybaseASEDriver;vclimg;IndyProtocols;dbxcds;DBXMySQLDriver;vclactnband;bindengine;vcldb;soaprtl;bindcompdbx;vcldsnap;bindcompvcl;vclie;vcltouch;DBXDb2Driver;websnap;DBXOracleDriver;CustomIPTransport;VclSmp;dsnap;IndyIPServer;DBXInformixDriver;fmxase;vcl;IndyCore;IndyIPCommon;dsnapcon;DBXFirebirdDriver;DBXMSSQLDriver;inet;fmxobj;vclx;inetdbxpress;webdsnap;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)
73 |
74 |
75 | DEBUG;$(DCC_Define)
76 | true
77 | false
78 | true
79 | true
80 | true
81 |
82 |
83 | false
84 |
85 |
86 | false
87 | RELEASE;$(DCC_Define)
88 | 0
89 | false
90 |
91 |
92 |
93 | MainSource
94 |
95 |
96 |
97 |
98 |
99 | Cfg_2
100 | Base
101 |
102 |
103 | Base
104 |
105 |
106 | Cfg_1
107 | Base
108 |
109 |
110 |
111 | Delphi.Personality.12
112 |
113 |
114 |
115 |
116 | False
117 | False
118 | 1
119 | 0
120 | 0
121 | 0
122 | False
123 | False
124 | False
125 | False
126 | False
127 | 1033
128 | 1252
129 |
130 |
131 |
132 |
133 | 1.0.0.0
134 |
135 |
136 |
137 |
138 |
139 | 1.0.0.0
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 | DocumentDirectory.dpr
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | Contents\MacOS\
161 | DocumentDirectory.rsm
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | Entitlements.plist
175 |
176 |
177 |
178 |
179 | Info.plist
180 |
181 |
182 |
183 |
184 | 1
185 | .dylib
186 |
187 |
188 | 0
189 | .bpl
190 |
191 |
192 | Contents\MacOS
193 | 1
194 | .dylib
195 |
196 |
197 | 1
198 | .dylib
199 |
200 |
201 |
202 |
203 | 1
204 | .dylib
205 |
206 |
207 | 0
208 | .dll;.bpl
209 |
210 |
211 | Contents\MacOS
212 | 1
213 | .dylib
214 |
215 |
216 | 1
217 | .dylib
218 |
219 |
220 |
221 |
222 | 1
223 |
224 |
225 | 1
226 |
227 |
228 |
229 |
230 | Contents
231 | 1
232 |
233 |
234 |
235 |
236 | 1
237 |
238 |
239 |
240 |
241 | 1
242 |
243 |
244 | 1
245 |
246 |
247 |
248 |
249 | 1
250 |
251 |
252 | 1
253 |
254 |
255 |
256 |
257 | 1
258 |
259 |
260 |
261 |
262 | Contents
263 | 1
264 |
265 |
266 |
267 |
268 | 1
269 |
270 |
271 | 1
272 |
273 |
274 |
275 |
276 | Contents\Resources
277 | 1
278 |
279 |
280 |
281 |
282 | 1
283 |
284 |
285 | 1
286 |
287 |
288 |
289 |
290 | 1
291 |
292 |
293 | 1
294 |
295 |
296 |
297 |
298 | 1
299 |
300 |
301 | 0
302 |
303 |
304 | Contents\MacOS
305 | 1
306 |
307 |
308 | 1
309 |
310 |
311 |
312 |
313 | 1
314 |
315 |
316 |
317 |
318 | 0
319 |
320 |
321 | 0
322 |
323 |
324 | Contents\MacOS
325 | 0
326 |
327 |
328 | 0
329 |
330 |
331 |
332 |
333 | 1
334 |
335 |
336 | 0
337 |
338 |
339 | Contents\MacOS
340 | 1
341 |
342 |
343 | 1
344 |
345 |
346 |
347 |
348 | Contents\MacOS
349 | 1
350 | .framework
351 |
352 |
353 | 0
354 |
355 |
356 |
357 |
358 | 1
359 |
360 |
361 |
362 |
363 | 1
364 |
365 |
366 | 1
367 |
368 |
369 |
370 |
371 | 1
372 |
373 |
374 | Contents\MacOS
375 | 0
376 |
377 |
378 | Contents\MacOS
379 | 1
380 |
381 |
382 | 1
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 | True
393 | True
394 | False
395 |
396 |
397 | 12
398 |
399 |
400 |
401 |
402 |
403 |
--------------------------------------------------------------------------------
/SpecialFolders/DocumentDirectory.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/malcolmgroves/delphi-samples/42039c04713d2dc3ac97493fa54ebe815bbed623/SpecialFolders/DocumentDirectory.res
--------------------------------------------------------------------------------
/SpecialFolders/fMain.fmx:
--------------------------------------------------------------------------------
1 | object Form2: TForm2
2 | Left = 0
3 | Top = 0
4 | Caption = 'Documents Folder'
5 | ClientHeight = 416
6 | ClientWidth = 426
7 | FormFactor.Width = 1680
8 | FormFactor.Height = 1050
9 | FormFactor.Devices = [dkDesktop]
10 | object Label1: TLabel
11 | Height = 15.000000000000000000
12 | Position.X = 168.000000000000000000
13 | Position.Y = 17.000000000000000000
14 | Text = 'Label1'
15 | Width = 409.000000000000000000
16 | end
17 | object Button1: TButton
18 | DisableFocusEffect = False
19 | Height = 22.000000000000000000
20 | Position.X = 16.000000000000000000
21 | Position.Y = 10.000000000000000000
22 | Text = 'Show Contents'
23 | Width = 135.000000000000000000
24 | OnClick = Button1Click
25 | end
26 | object ListBox1: TListBox
27 | Touch.InteractiveGestures = [igPan]
28 | Height = 345.000000000000000000
29 | Position.X = 16.000000000000000000
30 | Position.Y = 56.000000000000000000
31 | Width = 393.000000000000000000
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/SpecialFolders/fMain.pas:
--------------------------------------------------------------------------------
1 | unit fMain;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Layouts, FMX.ListBox;
8 |
9 | type
10 | TForm2 = class(TForm)
11 | Label1: TLabel;
12 | Button1: TButton;
13 | ListBox1: TListBox;
14 | procedure Button1Click(Sender: TObject);
15 | private
16 | { Private declarations }
17 | public
18 | { Public declarations }
19 | end;
20 |
21 | var
22 | Form2: TForm2;
23 |
24 | implementation
25 | uses
26 | {$IFDEF MSWINDOWS}
27 | Winapi.ShlObj, ComObj, Winapi.Windows, FMX.Platform.Win,
28 | {$ELSE}
29 | Macapi.Foundation, Macapi.CocoaTypes,
30 | {$ENDIF}
31 | IOUtils;
32 | {$R *.fmx}
33 |
34 | procedure TForm2.Button1Click(Sender: TObject);
35 | function GetDocumentDirectory : string;
36 | {$IFDEF MSWINDOWS}
37 | var
38 | szBuffer: array [0..MAX_PATH] of Char;
39 | begin
40 | OleCheck (SHGetFolderPath ( FmxHandleToHWND(Handle),
41 | CSIDL_MYDOCUMENTS,
42 | 0,
43 | 0,
44 | szBuffer));
45 | Result := szBuffer;
46 | {$ELSE}
47 | var
48 | FileMgr : NSFileManager;
49 | URL : NSURL;
50 | Error : NSError;
51 | begin
52 | FileMgr := TNSFileManager.Create;
53 | URL := FileMgr.URLForDirectory(NSDocumentDirectory,
54 | NSUserDomainMask,
55 | nil,
56 | false,
57 | @Error);
58 | if Assigned(Error) then
59 | raise Exception.Create(Error.localizedDescription.UTF8String);
60 |
61 | Result := URL.path.UTF8String;
62 | {$ENDIF}
63 | end;
64 | var
65 | DocumentsPath, Filename : String;
66 | begin
67 | DocumentsPath := GetDocumentDirectory;
68 | Label1.Text := DocumentsPath;
69 |
70 |
71 | for Filename in TDirectory.GetDirectories(DocumentsPath) do
72 | Listbox1.Items.Add(Format('Folder : %s', [Filename]));
73 |
74 | for Filename in TDirectory.GetFiles(DocumentsPath) do
75 | Listbox1.Items.Add(Format('File : %s', [Filename]));
76 |
77 | end;
78 |
79 | end.
80 |
--------------------------------------------------------------------------------