Fórum Trabalhar com Array Property em Delphi #589906
18/12/2017
0
Bom dia,
Tenho o seguinte código:
TRecordRateio = Record
IdContaCorrente : Integer;
CodBanco : String;
ValorRateio : Currency;
DataCredito : TDateTime;
end;
TArrayOfRateio = Array of TRecordRateio;
{ TTeste }
TTeste = class(TComponent)
private
fNome : String;
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;
published
property Nome : String read fNome write fNome;
end;
implementation
function TTeste.GetRateio(AIndex: Integer): TArrayOfRateio ;
begin
Result[AIndex].IdContaCorrente := Self.fRateio[AIndex].IdContaCorrente;
Result[AIndex].CodBanco := Self.fRateio[AIndex].CodBanco;
Result[AIndex].ValorRateio := Self.fRateio[AIndex].ValorRateio;
Result[AIndex].DataCredito := Self.fRateio[AIndex].DataCredito;
end;
procedure TACBrCedente.SetRateio(AIndex: Integer;
const Value: TArrayOfRateio );
begin
frateio[AIndex].Idcontacorrente := Value[AIndex].IdContaCorrente;
fRateio[AIndex].CodBanco := Value[AIndex].CodBanco;
fRateio[AIndex].ValorRateio := Value[AIndex].ValorRateio;
fRateio[AIndex].DataCredito := Value[AIndex].DataCredito ;
end;
Tento passar os valores da seguinte forma, porém ocorre erro.
Cedente.Rateio[i].IdContaCorrente := qry.FieldByName(''IdContaCorrente'').AsInteger;
Tenho o seguinte código:
TRecordRateio = Record
IdContaCorrente : Integer;
CodBanco : String;
ValorRateio : Currency;
DataCredito : TDateTime;
end;
TArrayOfRateio = Array of TRecordRateio;
{ TTeste }
TTeste = class(TComponent)
private
fNome : String;
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;
published
property Nome : String read fNome write fNome;
end;
implementation
function TTeste.GetRateio(AIndex: Integer): TArrayOfRateio ;
begin
Result[AIndex].IdContaCorrente := Self.fRateio[AIndex].IdContaCorrente;
Result[AIndex].CodBanco := Self.fRateio[AIndex].CodBanco;
Result[AIndex].ValorRateio := Self.fRateio[AIndex].ValorRateio;
Result[AIndex].DataCredito := Self.fRateio[AIndex].DataCredito;
end;
procedure TACBrCedente.SetRateio(AIndex: Integer;
const Value: TArrayOfRateio );
begin
frateio[AIndex].Idcontacorrente := Value[AIndex].IdContaCorrente;
fRateio[AIndex].CodBanco := Value[AIndex].CodBanco;
fRateio[AIndex].ValorRateio := Value[AIndex].ValorRateio;
fRateio[AIndex].DataCredito := Value[AIndex].DataCredito ;
end;
Tento passar os valores da seguinte forma, porém ocorre erro.
Cedente.Rateio[i].IdContaCorrente := qry.FieldByName(''IdContaCorrente'').AsInteger;

Seila
Curtir tópico
+ 0
Responder
Posts
22/12/2017
Wesley Yamazack
Opa Seila, blz?
Qual erro está acontecendo?
Qual erro está acontecendo?
Responder
Gostei + 0
18/07/2018
Seila
Já resolvido.
Obrigada.
Obrigada.
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)