unit Foobar;
interface
uses
Controls;
type
TCmeMaskType = (mtSearch, mtImport);
TCmeMaskTypes =
set of TCmeMaskType;
TCmeComponent =
record
CtrlClass: TControlClass;
MaskTypes: TCmeMaskTypes;
end;
TCmeComponentTab =
record
TabName:
string;
Components:
array of TCmeComponent;
end;
TCmeComponentCollection =
array of TCmeComponentTab;
implementation
uses
StdCtrls;
var
GCompRec: TCmeComponentCollection;
procedure InitCompRec();
type
TCompRec = (
crStandard,
crAdditional
);
TCompRecStandard = (
crStandardLabel,
crStandardEdit
);
TCompRecAdditional = (
crAdditionalMemo
);
PCmeComponentArray = ^TCmeComponentArray;
TCmeComponentArray =
array [0..High(Integer)
div SizeOf(TCmeComponent) - 1]
of TCmeComponent;
resourcestring
StrCompRecTabNameStandard = '
Standard';
StrCompRecTabNameAdditional = '
Additional';
const
CompRecTabNames:
array [TCompRec]
of string = (
StrCompRecTabNameStandard,
StrCompRecTabNameAdditional
);
CompRecStandard:
array [TCompRecStandard]
of TCmeComponent = (
(
CtrlClass: TLabel;
MaskTypes: []
),
(
CtrlClass: TEdit;
MaskTypes: [mtSearch]
)
);
CompRecAdditional:
array [TCompRecAdditional]
of TCmeComponent = (
(
CtrlClass: TMemo;
MaskTypes: []
)
);
CompRecComponents:
array [TCompRec]
of record
High: Integer;
Comp: ^TCmeComponent;
end = (
(
High: Integer(High(CompRecStandard));
Comp: @CompRecStandard;
),
(
High: Integer(High(CompRecAdditional));
Comp: @CompRecAdditional;
)
);
var
Entry: TCompRec;
Index: Integer;
begin
SetLength(GCompRec, Integer(High(TCompRec)) + 1);
for Entry := Low(TCompRec)
to High(TCompRec)
do
with GCompRec[Integer(Entry)]
do
begin
TabName := CompRecTabNames[Entry];
with CompRecComponents[Entry]
do
begin
SetLength(Components, High + 1);
for Index := 0
to High
do
Components[
Index] := PCmeComponentArray(Comp)[
Index];
end;
end;
end;
initialization
InitCompRec();
end.