Can anyone advise me how to set up a Property which is an array of Record
Types.
Here is a skeleton of my class code - the compiler does not like my use of
Records in a Property Array
TLibInfo = Record
lName: String; // Library Name
mCount: Integer; // Number of Macros in library
sCount: Integer; // Number of Shared Subroutines
sPublic: Integer; // Number of Shared Public Variables
sPrivate: Integer; // Number of Bytes of shared local storage.
end;
TMacInfo = Record
mName: String; // Macro Name
mTarget: Integer; // Target PIC Type
sCount: Integer; // Number of Subroutines used
sPublic: Integer; // Number of Public Variables
sPrivate: Integer; // Number of Bytes of local storage.
end;
TLibCmds = Class
Private
fSource: TStrings;
fLibInfo: TLibInfo;
fMacInfo: Array of TMacInfo;
Procedure SetSource(Source: TStrings);
function GetMacInfo(AIndex: Integer): TMacInfo;
Public
constructor Create(Owner: TObject);
destructor Destroy; override;
Published
Property pLibSource: TStrings Read fSource Write SetSource;
Property pLibInfo: TLibInfo Read fLibInfo;
Property pMacInfo[Const AIndex: Integer]:TMacInfo Read GetMacInfo;
default;
end;
Implementation
Constructor TLibCmds.Create;
Begin
Inherited Create;
fSource := TStringList.Create;
end;
Destructor TLibCmds.Destroy;
Begin
fSource.Free;
Inherited Destroy;
end;
Procedure TLibCmds.SetSource;
begin
fSource.Assign(Source);
CleanCode(fSource); // Clean up data - remove blanks and comments
end;
function TLibCmds.GetMacInfo(AIndex: Integer): TMacInfo;
begin
If (AIndex < 0) or (AIndex >= High(fMacInfo)) then
Raise Exception.Create('Invalid Index')
else
Result := fMacInfo[AIndex];
end;
Can anyone advise a work around?
JohnB
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi