Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #9  
Antiguo 20-08-2006
mahlon mahlon is offline
Miembro
 
Registrado: ago 2006
Posts: 62
Poder: 20
mahlon Va por buen camino
Thumbs up aclaracion

el segundo codigo incluye numeros como 0.5 ?






Cita:
Empezado por mamu
Un TEdit limitado para entrar números Enteros

Código:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
 var sNumAnterior:string;
 begin
   sNumAnterior := (sender as TEdit).Text;
   if (key <> #3) and (key <> #22) then  // #3 = Copiar (Ctrl + C)
   begin                                 // #22 = Pegar (Ctrl + V)
     if key = '-' then
     begin
       if ((pos(key,(sender as TEdit).Text) > 0) and
          (pos(key,(sender as TEdit).SelText) = 0))
          or
          ((sender as TEdit).SelStart > 0)
       then key:=#0;
     end
     else if not (key in ['0'..'9',#8]) then key:=#0;
   end;
   if key = #22 then
   try
     key := #0;
     (sender as TEdit).PasteFromClipBoard;
     StrToInt((sender as TEdit).Text);
   except
     (sender as TEdit).Text := sNumAnterior;
     (sender as TEdit).SelStart := Length((sender as TEdit).Text);
   end;
 end;
Un TEdit limitado para entrar números Reales

Código:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
 var sNumAnterior:string;
 begin
   sNumAnterior := (sender as TEdit).Text;
   if (key <> #3) and (key <> #22) then  // #3 = Copiar (Ctrl + C)
   begin                                 // #22 = Pegar (Ctrl + V)
     if key in ['-','.'] then
     begin
       if (pos(key,(sender as TEdit).Text) > 0) and
          (pos(key,(sender as TEdit).SelText) = 0)
          then key:=#0;
       case key of
         '-': if ((sender as TEdit).SelStart > 0) then key:=#0;
         '.': if ((sender as TEdit).SelStart = 0) or
                 (((sender as TEdit).SelStart = 1) and
                 ((sender as TEdit).Text[1] = '-'))
              then key:=#0;
       end;
     end
     else if not (key in ['0'..'9',#8]) then key:=#0;
   end;
   if key = #22 then
   try
     key := #0;
     (sender as TEdit).PasteFromClipBoard;
     StrToFloat((sender as TEdit).Text);
   except
     (sender as TEdit).Text := sNumAnterior;
     (sender as TEdit).SelStart := Length((sender as TEdit).Text);
   end;
 end;
by Arturo_Ortí

[email protected]
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
BUtton yoko Varios 1 30-06-2006 04:28:05
Button en DBgrid Iskariote0087 Varios 2 15-05-2006 13:06:13
Descargar icono de un Button Iskariote0087 Varios 2 10-01-2006 12:04:36
añadir a TQuickReport un button jmlifi Impresión 2 11-10-2005 15:22:37
colores a un Button dmagui OOP 3 27-06-2005 19:51:44


La franja horaria es GMT +2. Ahora son las 09:46:26.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi