Ich hab noch ne Alternative mit etwas mehr Konstanten:
Delphi-Quellcode:
type
tCmeMaskType = (mtSearch, mtImport);
tCmeMaskTypes = set of tCmeMaskType;
tCmeComponent = record
C: TControlClass; // Component
R: tCmeMaskTypes; // RestrictedToMaskTypes
end;
tCmeComponentTab = record
N: string; // TabName
Co: array of tCmeComponent; // Components
end;
tCmeComponentCollection = array of tCmeComponentTab;
implementation
{$R *.dfm}
var
CompRec: array[0..1] of tCmeComponentTab = (
(
// Standard Palette
N: 'Standard';
Co: nil; ),
(
// Additional
N: 'Additional';
Co: nil; )
);
procedure CmeComponentTab_SetComps(var ATab: tCmeComponentTab; const AComps: array of tCmeComponent);
var
i: Integer;
begin
SetLength(ATab.Co, Length(AComps));
for i := Low(AComps) to High(AComps) do
ATab.Co[i] := AComps[i];
end;
const
cStandardComps: array[0..1] of tCmeComponent = (
(c: TLabel; R: []),
(c: TEdit; R: [mtSearch])
);
cAdditionalComps: array[0..0] of tCmeComponent = (
(c: TMemo; R: [])
);
initialization
CmeComponentTab_SetComps(CompRec[0], cStandardComps);
CmeComponentTab_SetComps(CompRec[1], cAdditionalComps);
end.
Nicos Variablennamen sind natürlich besser.
HTH,
Uli.