Hola Fidel.
Cita:
... se me ocurre para no esperar que el operador Acepte el mensaje solo guardar un log ¿Como haria eso?
|
Sobre ese punto, podes hacer algo como esto:
Código Delphi
[-]
function VerifyInput(str: string; var Value: Double): Boolean;
var
logf: string;
begin
str := StringReplace( str, ' ','', [rfReplaceAll] );
Result := TryStrToFloat( str, Value );
if not Result then
begin
logf := ExtractFilePath( Application.ExeName ) +
FormatDateTime( 'yyyy-mm-dd',Date ) + 'E_ComPort.LOG';
with TStringList.Create do
try
Value := 0;
if FileExists( logf ) then
LoadFromFile( logf );
Add( Format( 'Valor: %s : %s',[str,
FormatDateTime( 'dd/mm/yyyy - hh:mm:ss',Now )] ) );
SaveToFile( logf );
finally
Free;
end;
end;
end;
Llamada:
Código Delphi
[-]
...
var
s : string;
v: Double;
begin
s := ' 0.123 456789';
if VerifyInput( s, v ) then
begin
...
Saludos