Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Problemas con accesos directos por combinación de teclas (https://www.clubdelphi.com/foros/showthread.php?t=81634)

BioStudio 02-12-2012 05:42:31

Problemas con accesos directos por combinación de teclas
 
Resulta que necesitaría aplicar el siguiente código:

Código Delphi [-]
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;  Shift: TShiftState);
begin
  if Key = VK_F4 then
    ShowMessage('Tecla F4 presionada');
end;

Al iniciar el programa para chequear una variable en particular, probé de utilizarlo pero al iniciar no pasa nada.. probé con otras teclas y combinaciones al iniciar el formulario y nada.. ¿ algún dato en particular que requiera esta función?

nlsgarcia 02-12-2012 17:33:46

BioStudio,

Cita:

Empezado por BioStudio
¿algún dato en particular que requiera esta función?

Revisa este código:
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
   // Specifies whether the form should receive keyboard events before the active control.
   // If KeyPreview is true, keyboard events occur on the form before they occur on the active control.
   KeyPreview := True;
end;
El código anterior habilitara la lectura de teclas en el formulario.

Espero sea útil :)

Nelson.

BioStudio 02-12-2012 22:12:42

Exacto! faltaba justamente eso! gracias!


La franja horaria es GMT +2. Ahora son las 23:47:35.

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