I'm using DELPHI 7 trying to create a class with the following structure
Type
Tclasse_Envio_JSON = class(TThread)
private
fCampos: Array of Variant;
fIdade : Integer;
fNome : String[40];
function Get_Idade: Integer;
procedure Set_Idade(const Value: Integer);
function Get_Campos: array of Variant;
procedure Set_Campos(const Value: array of Variant);
public
Property Idade : Integer read Get_Idade write Set_Idade;
Property Campos : Array of Variant read Get_Campos write Set_Campos;
protected
procedure Execute; Override;
end;
I'm having difficulty implementing the:
property Campos
function Get_Campos
procedure Set_Campos
The idea of using it would be
variavelA := TClasse_Envio_JSon.Create;
VariavelA.Campo := ['CampoA','CampoB','CampoC'];
VariavelA.Valor :=['Valor_CampoA','Valor_CampoB','Valor_CampoC'];
How do I use the ARRAY Of VARIANT in this situation ???
Or if any of you have any other idea I can get the same result .. I'm all EYES :)
It could do something with bounded STRINGS and search them, but the bid
with Array of Variant is much cleaner.
We use a lot of Array of Variant in passing parameters in function.
Inclusive This class I am trying to implement is to substitute a function.
Function Envia_Json(pCampos : Array of Variant; pValores : Array of Variant) : Boolean;
Var A : Integer;
begin
For A:= 0 to High(pCampos) do
begin
ETC..ETC..
end;
ETC.. ETC..
end;
Using Function Envia_Json ..:
If Envia_Json(['CampoA','CampoB'],['ValorAA','VAlorA','ValorB','ValorC','Valord']) then
begin
end;
I hope to have demonstrated my doubt and need clearly ..
If any of you find my lines confusing, please write to me and I'll try to explain it better.