Ver Mensaje Individual
  #14  
Antiguo 19-09-2006
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Ya. Entonces el código queda así:

Código Delphi [-]
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  // supongo que por OR querías decir AND
  if (Ord(Key) <> VK_DELETE) and (Ord(Key) <> VK_BACK) then
  begin
    Contador := Contador + 1;
  end;

  if ((Contador mod 2) = 0) and (Contador > 2) then
  begin
    Edit1.Text := Edit1.Text + '/';
    Edit1.SelStart := Length(Edit1.Text);
  end;
end;


Pero si escribo, por decir algo, "1", luego BACKSPACE, luego "2" y "3", en el Edit aparece "2/3".

Ya no está resultando "mucho más fácil", ¿no crees?

// Saludos
Responder Con Cita