![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|
|
#1
|
|||
|
|||
|
gracias...
y para que solo pueda poner numeros en los edit? |
|
#2
|
||||
|
||||
|
Cita:
Saludos
__________________
Van Troi De León (Not) Guía, Code vB:=Delphi-SQL, ¿Cómo? Viajar en el tiempo no es teóricamente posible, pues si lo fuera, ya estarían aqui contándonos al respecto! |
|
#3
|
||||
|
||||
|
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;
[email protected] |
|
#4
|
|||
|
|||
|
Cita:
|
|
#5
|
|||
|
|||
|
el segundo codigo incluye numeros como 0.5 ?
Cita:
|
|
#6
|
||||
|
||||
|
Cita:
Saludos. |
|
#7
|
|||
|
|||
|
Cita:
necesito algo parecido pero que solo acepte estos caracteres: desde la a hasta la z y A hasta la Z (mayusculas). Saludos |
|
#8
|
||||
|
||||
|
Pues igual que con números:
Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente, se lo volveré a explicar hasta que no lo entienda, Gracias. |
|
#9
|
|||
|
|||
|
busqueda
Cita:
![]() ![]() |
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
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 |
|