Cita:
Empezado por movorack
Solo cámbialo por el objeto correcto.
|
El código lo modifique así como me dices, pero al compilar sigue con el mismo error de tipos incompatibles.
Código Delphi
[-]
procedure ValidarPorcentajeKeyPressEdit(Caracter: Char;Edit:TrDBEdit;Sender: TObject);
var
pos: Cardinal;
begin
i:=0;
if ( StrScan('0123456789.,'+chr(7)+chr(8)+#13, Caracter) = nil ) then Caracter := #0;
if (Caracter = '.') or (Caracter = ',') then Caracter := ',';
for i := 1 to length(Edit.Text) do
if ( copy((Sender as TrDBEdit), i , 1) = ',' ) and not ( StrScan(',', Caracter) = nil ) then Caracter := #0;
with Sender as TrDBEdit do
begin
pos := System.Pos(',', Text);
if not LongBool(Pos) then Dec(Pos);
ReadOnly := not (Caracter in ['0'..'9',#13, ',', #8]) or
(Pos <> $FFFFFFFF) and (Caracter = ',') or
((Caracter <> #8) and (Caracter <> #13) and (Pos < (SelStart - 1)));
end;
end;