Ver Mensaje Individual
  #8  
Antiguo 02-06-2007
Wellnic Wellnic is offline
Miembro
 
Registrado: mar 2007
Posts: 68
Reputación: 18
Wellnic Va por buen camino
Talking

Quería llamar la atención sobre un pequeño detalle, y es que usando directamente el evento Edit1KeyPress, el código se ejecuta antes de actualizarse el TEdit (al menos en mi querido Delphi 3. ¿No sería mejor utilizar un Timer?:
Código Delphi [-]
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
Timer1.Enabled:= True;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
      IF Trim(Edit1.Text)=''THEN
      BEGIN
           IF(Key=#69)OR(Key=#86)THEN //E=69 - V=86 .. Utiliza la propiedad "CharCase" en ecUpperCase
              Exit
           ELSE
              Key:=#0;
      END
      ELSE
      BEGIN
           IF Key = #8 THEN Exit; // Tecla 
           IF (Key<#48)OR(Key > #58) THEN
               Key:=#0;
      END;
end;

Timer1.Enabled:= False;
End;

Asimismo, en el Object inspector conviene ponerle al Timer las propiedades Enable a False e Interval a 1.
Responder Con Cita