Ver Mensaje Individual
  #1  
Antiguo 11-05-2017
Avatar de look
look look is offline
Miembro
 
Registrado: sep 2007
Ubicación: The Shire
Posts: 656
Reputación: 17
look Va camino a la fama
Edit monetario, solo numeros , limitar decimales.

Que tal amigos, tengo el siguiente codigo, este me permite ingresar solo numeros en un edit, algo asi : "99999.9999", lo que quiero es liminar la cantidad de decimales, y tambien agregar el simbolo de miles "," en la posicion correcta mientras se escribe en el edit...

Código Delphi [-]
    procedure TFrmMain.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
      if not (Key in [#8, '0'..'9', '-', '.']) then
      begin
        Key := #0;
      end
      else
      if ((Key = '.') or (Key = '-')) and (Pos(Key, (Sender as TEdit).Text) > 0) then
      begin
        Key := #0;
      end
      else
      if (Key = '-') and  ((Sender as TEdit).SelStart <> 0) then
      begin
        Key := #0;
      end;
     
    end;
__________________
all your base are belong to us
Responder Con Cita