![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
|
|
#1
|
||||
|
||||
|
Hola!
Es sólo una sugerencia, porque no pones el código en el Evento FormKeyPress del formulario: Código:
if Key = #13 then
if txtDescuento.Focused then
frmAlbaranes.SpeedButton1.Click;;
De todas maneras yo lo realizo de la manera que te comentaba arriba y me funciona perfectamente. Espero que te sirva. Saludos! |
|
#2
|
|||
|
|||
|
Hola Nuria he hecho lo que tu me has dicho:
procedure TfrmAlbaranes.FormKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then if txtDescuento.Focused then frmAlbaranes.SpeedButton1.Click; end; Tengo en el evento OnKeyprees del formulario y del txtDescuento y no me funciona me captura todas las teclas menos la del intro y no se por que puede ser! Ademas lo habia puesto en el keyprees del txtDescuento por costumbre ya que yo vengo del VB. SALUDOS!! |
|
#3
|
|||
|
|||
|
pongo esto y ahora no me captura el evento
procedure TfrmAlbaranes.FormKeyPress(Sender: TObject; var Key: Char);
begin if Key = #13 then if txtDescuento.Focused then begin MessageDlg(Key + ' has been pressed', mtInformation, [mbOK], 0); frmAlbaranes.SpeedButton1.Click; end; end; Ademas me he asegurado que la propiedad KeyPreview del formulario esta a true. |
|
#4
|
|||
|
|||
|
es el intro !!
Sin embargo si pongo esto:
procedure TfrmAlbaranes.FormKeyPress(Sender: TObject; var Key: Char); begin MessageDlg(Key + ' has been pressed', mtInformation, [mbOK], 0); if Key = #13 then if txtDescuento.Focused then frmAlbaranes.SpeedButton1.Click end; Me captura todos las teclas MENOS EL INTRO ![]() |
|
#5
|
||||
|
||||
|
Cuando pulsas intro, que valor tiene Key?
|
|
#6
|
|||
|
|||
|
No Me Sale Nada!!
Es que no sale ni siquiera ningun valor, se lo salta, incluso si pulso la tecla Backspace me sale algo parecido a un cuadrado pero si pulso intro NO ME SALE NADA!!
|
|
#7
|
|||
|
|||
|
Acabo de probar lo siguiente.
Propiedad del formulario KeyPreview a true y Código:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
ShowMessage('lolo');
end;
![]() |
![]() |
|
|
|