Einzelnen Beitrag anzeigen

Benutzerbild von nicodex
nicodex

Registriert seit: 2. Jan 2008
Ort: Darmstadt
286 Beiträge
 
Delphi 2007 Professional
 
#4

Re: Konstantes Array aus Records die variables Array enthalt

  Alt 28. Mai 2008, 13:27
Delphi-Quellcode:
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: array [0..1] of TCmeComponentTab = (
    (
      TabName: 'Standard';
      Components: nil // set in InitCompRec()
    ),
    (
      TabName: 'Additional';
      Components: nil // set in InitCompRec()
    )
  );

procedure InitCompRec();
begin
  with GCompRec[0] do
  begin
    SetLength(Components, 2);
    with Components[0] do
    begin
      CtrlClass := TLabel;
      MaskTypes := [];
    end;
    with Components[1] do
    begin
      CtrlClass := TEdit;
      MaskTypes := [mtSearch];
    end;
  end;
  with GCompRec[1] do
  begin
    SetLength(Components, 1);
    with Components[0] do
    begin
      CtrlClass := TMemo;
      MaskTypes := [];
    end;
  end;
end;

initialization

  InitCompRec();

end.
  Mit Zitat antworten Zitat