-1
unit Exemplo;
interface
uses Classes,
SysUtils, typinfo;
const
type
{TRecordRateio}
TRecordRateio = Record
IdContaCorrente : Integer;
CodBanco : String;
Agencia : String;
DVAgencia : String;
ContaCorrente : String;
DVContaCorrente : String;
DVAgenciaConta : String;
NomeBeneficiario : String;
CodRateio : String;
EPercentual : String;
ValorRateio : Currency;
FloatingRateio : String;
DataCredito : TDateTime;
end;
TArrayOfRateio = Array of TRecordRateio;
TTeste = class(TComponent)
private
fRateio : TArrayOfRateio;
function GetRateio(AIndex: Integer): TArrayOfRateio;
procedure SetRateio(AIndex: Integer; const Value: TArrayOfRateio);
public
constructor Create( AOwner : TComponent ) ; override ;
destructor Destroy; override;
property Rateio[AIndex : Integer] : TArrayOfRateio read GetRateio Write SetRateio; default;
published
property Nome : String read fNome write fNome;
end;
implementation
Uses Forms, Math, dateutils, strutils;
constructor TTeste.Create( AOwner : TComponent );
begin
inherited Create(AOwner);
fNome := '';
end;
destructor TTeste.Destroy;
begin
inherited;
end;
function TTeste.GetRateio(AIndex: Integer): TArrayOfRateio;
begin
Result[AIndex].IdContaCorrente := Self.fRateio[AIndex].IdContaCorrente;
Result[AIndex].CodBanco := Self.fRateio[AIndex].CodBanco;
Result[AIndex].Agencia := Self.fRateio[AIndex].Agencia;
Result[AIndex].DVAgencia := Self.fRateio[AIndex].DVAgencia;
Result[AIndex].ContaCorrente := Self.fRateio[AIndex].ContaCorrente;
Result[AIndex].DVContaCorrente := Self.fRateio[AIndex].DVContaCorrente;
Result[AIndex].DVAgenciaConta := Self.fRateio[AIndex].DVAgenciaConta;
Result[AIndex].NomeBeneficiario := Self.fRateio[AIndex].NomeBeneficiario;
Result[AIndex].CodRateio := Self.fRateio[AIndex].CodRateio;
Result[AIndex].FloatingRateio := Self.fRateio[AIndex].FloatingRateio;
Result[AIndex].EPercentual := Self.fRateio[AIndex].EPercentual;
Result[AIndex].ValorRateio := Self.fRateio[AIndex].ValorRateio;
Result[AIndex].DataCredito := Self.fRateio[AIndex].DataCredito;
end;
procedure TTeste.SetRateio(AIndex: Integer;
const Value: TArrayOfRateio);
begin
frateio[AIndex].Idcontacorrente := Value[AIndex].IdContaCorrente;
fRateio[AIndex].CodBanco := Value[AIndex].CodBanco;
fRateio[AIndex].Agencia := Value[AIndex].Agencia;
fRateio[AIndex].DVAgencia := Value[AIndex].DVAgencia;
fRateio[AIndex].ContaCorrente := Value[AIndex].ContaCorrente;
fRateio[AIndex].DVContaCorrente := Value[AIndex].DVContaCorrente;
fRateio[AIndex].DVAgenciaConta := Value[AIndex].DVAgenciaConta;
fRateio[AIndex].NomeBeneficiario := Value[AIndex].NomeBeneficiario;
fRateio[AIndex].CodRateio := Value[AIndex].CodRateio;
fRateio[AIndex].FloatingRateio := Value[AIndex].FloatingRateio;
fRateio[AIndex].EPercentual := Value[AIndex].EPercentual;
fRateio[AIndex].ValorRateio := Value[AIndex].ValorRateio;
fRateio[AIndex].DataCredito := Value[AIndex].DataCredito ;
end;
How to access the Test.Apportioning property above?
It is not clear what you want. If
Teste
is a variable of the typeTTeste
and just want to access, it would be something likeTeste.Rateio[0].Agencia
. Are you having any problems with this code? Which?– EMBarbosa