Fórum Array Dinaminco no FindKey #290656

03/08/2005

0

Não consigo utilizar um Array Dinamico emum FindKey;
Hoje, tenho isso, mas não funciona:

procedure TForm1.Button1Click(Sender: TObject);
Var
v_CH : Array Of Variant;
begin
SetLength( v_CH , 0 );

If ( Trim( Edit1.Text ) <> ´´ ) Then Begin
SetLength( v_CH , Length( v_CH ) + 1 );
v_CH[ Length( v_CH ) - 1 ] := Edit1.Text;
End;

If ( Trim( Edit2.Text ) <> ´´ ) Then Begin
SetLength( v_CH , Length( v_CH ) + 1 );
v_CH[ Length( v_CH ) - 1 ] := Edit2.Text;
End;

If ( Trim( Edit3.Text ) <> ´´ ) Then Begin
SetLength( v_CH , Length( v_CH ) + 1 );
v_CH[ Length( v_CH ) - 1 ] := Edit3.Text;
End;

Find( v_CH );
end;

Procedure TForm1.Find( pCH : Array Of Variant );
Begin
Label1.Caption := ´´;

If Tab.FindKey([ pCH ]) Then
Label1.Caption := ´Ok´
Else
Label1.Caption := ´Não Ok´;
End;

Mas dá erro na compilação no Tab.FindKey([ pCH ])
Já tentei sem os ´[´ ´]´ mas tb não funciona.

-------------------
Preciso utlizar isso, pq tenho uma chave mutante( dados diferentes para chaves diferentes )
-------------------

Desde já grato.


Bfbraz

Bfbraz

Responder

Posts

04/08/2005

Bfbraz

Ainda não consegui resolver este problema.
Alguém sabe como posso fazer ???

att
Bruno


Responder

Gostei + 0

03/01/2020

Jian

Ainda não consegui resolver este problema.
Alguém sabe como posso fazer ???

att
Bruno




TArrayVarRec = array of TVarRec;

function VariantToVarRec(AInput: variant): TVarRec;
begin
if not VarIsEmpty(AInput) then
begin
Result.VType := vtVariant;
New(Result.VVariant);
Result.VVariant^:= AInput;
end;
end;

function TClass.GetParams(AnParams1, AnParams2: Integer): TArrayVarRec;
begin
SetLength(Result, 2);
Result[0] := VariantToVarRec(AnParams1);
Result[1] := VariantToVarRec(AnParams2);
end;

Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar