Experimente fazer assim:

MarcaDesmarcaReadOnly(VarArrayOf([DBEditConsignado, sdbeFornecedor]), 
VarArrayOf([true, false]));
MarcaDesmarcaReadOnly(VarArrayOf([DBEdParcelaEmp,DBEdValorTotalEmp,DBEdSaldoEmp]),True);
MarcaDesmarcaReadOnly(VarArrayOf(['ARREDONDA']),True);

Sds.

________________________________
To: delphi-br@yahoogrupos.com.br
From: [EMAIL PROTECTED]
Date: Wed, 20 Aug 2008 11:17:38 -0300
Subject: [delphi-br] Overload


Pessoal, bom dia! Essa é a minha primeira dúvida que estou enviando ao
fórum.
É o seguinte: durante a compilação não há erro nas procedures, mas há erro
na chamada delas. Não consegui entender o porque dos erros, sendo que as
procedures estão como Overload.

Segue abaixo a cópia das procedures, da chamada e dos erros de compilação:

*Arquivo1.pas*:
procedure MarcaDesmarcaReadOnly(ACampo: Array of String; AreadOnly:
boolean); overload;
procedure MarcaDesmarcaReadOnly(AComponente: Array of TWinControl;
AreadOnly: boolean); overload;
procedure MarcaDesmarcaReadOnly(ACampo: Array of String; AreadOnly: Array of
boolean); overload;
procedure MarcaDesmarcaReadOnly(AComponente: Array of TWinControl;
AreadOnly: Array of boolean); overload;

procedure MarcaDesmarcaReadOnly(ACampo: Array of String; AreadOnly:
boolean);
var
int_Loop: SmallInt;
begin
for int_Loop := 0 to High(ACampo) do
begin
dm_app.ReadOnlyDBControl(ACampo[int_Loop], AReadOnly);
end;
end;

procedure MarcaDesmarcaReadOnly(AComponente: Array of TWinControl;
AreadOnly: boolean);
var
int_Loop: SmallInt;
begin
for int_Loop := 0 to High(AComponente) do
begin
dm_app.ReadOnlyDBControl(AComponente[int_Loop], AReadOnly);
end;
end;

procedure MarcaDesmarcaReadOnly(ACampo: Array of String; AreadOnly: Array of
boolean); overload;
var
int_Loop: SmallInt;
begin
for int_Loop := 0 to High(ACampo) do
begin
dm_app.ReadOnlyDBControl(ACampo[int_Loop], AReadOnly[int_Loop]);
end;
end;

procedure MarcaDesmarcaReadOnly(AComponente: Array of TWinControl;
AreadOnly: Array of boolean); overload;
var
int_Loop: SmallInt;
begin
for int_Loop := 0 to High(AComponente) do
begin
dm_app.ReadOnlyDBControl(AComponente[int_Loop], AReadOnly[int_Loop]);
end;
end;

Obs.: A procedure ReadOnlyDBControl também é overload.

*Arquivo2.pas*:
MarcaDesmarcaReadOnly([DBEditConsignado, sdbeFornecedor], [true, false]);
MarcaDesmarcaReadOnly([DBEdParcelaEmp,DBEdValorTotalEmp,DBEdSaldoEmp],True);
MarcaDesmarcaReadOnly(['ARREDONDA'],True);
*Erros:*
[Error] Arquivo2.pas(222): Ambiguous overloaded call to
'MarcaDesmarcaReadOnlyB'
[Error] Arquivo2.pas(222): Ordinal type required
[Error] Arquivo2.pas(222): Incompatible types: 'Integer' and 'TSearchDBEdit'
[Error] Arquivo2.pas(222): There is no overloaded version of
'MarcaDesmarcaReadOnlyB' that can be called with these arguments
[Error] Arquivo2.pas(344): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(344): Ordinal type required
[Error] Arquivo2.pas(344): Incompatible types: 'Integer' and 'TDBEdit'
[Error] Arquivo2.pas(344): Incompatible types: 'Integer' and 'TDBEdit'
[Error] Arquivo2.pas(351): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(351): Ordinal type required
[Error] Arquivo2.pas(361): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(361): Ordinal type required
[Error] Arquivo2.pas(382): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(382): Ordinal type required
[Error] Arquivo2.pas(480): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(480): Ordinal type required
[Error] Arquivo2.pas(480): There is no overloaded version of
'MarcaDesmarcaReadOnly' that can be called with these arguments
[Error] Arquivo2.pas(681): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(681): Ordinal type required
[Error] Arquivo2.pas(682): Missing operator or semicolon
[Error] Arquivo2.pas(684): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(684): Ordinal type required
[Error] Arquivo2.pas(687): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(687): Ordinal type required
[Error] Arquivo2.pas(690): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(690): Ordinal type required
[Error] Arquivo2.pas(690): Incompatible types: 'Integer' and 'String'
[Error] Arquivo2.pas(699): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(699): Ordinal type required
[Error] Arquivo2.pas(699): Incompatible types: 'Integer' and 'String'
[Error] Arquivo2.pas(701): Ambiguous overloaded call to
'MarcaDesmarcaReadOnly'
[Error] Arquivo2.pas(701): Ordinal type required
[Error] Arquivo2.pas(701): Incompatible types: 'Integer' and 'String'
[Fatal Error] Arquivo2.pas(12): Could not compile used unit 'Arquivo2'
--
Charlestown

_________________________________________________________________
Confira vídeos com notícias do NY Times, gols direto do Lance, videocassetadas 
e muito mais no MSN Video!
http://video.msn.com/?mkt=pt-br

Responder a