Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 23-11-2014
carlosprotos carlosprotos is offline
Miembro
 
Registrado: abr 2014
Posts: 28
Poder: 0
carlosprotos Va por buen camino
Post Problema con hotkeys combinados.

Hola, tengo un problema con los hotkeys en delphi , hay una herramiena llamada Hotkey el cual lo uso para insertar hotkeys en un cuadro parecido al textbox , me funciona con los hotkeys de numeros,letras y todo eso. Pero cuando le agrego ALT+1 o ALT +k , o tambien CTRL+T , no me funciona la combinación.

Un claro ejemplo:
Código Delphi [-]
If GetKeystate(hk1.hotkey)<> 0 then
   checkbox.checked=true;
en el hk1.hotkey no me trabaja alponer ALT+1 (ejemplo)

Quisiera saber si hay alguna función o fuente que me ayude con ese problema.

Última edición por nlsgarcia fecha: 23-11-2014 a las 16:52:43. Razón: Sintaxis Delphi
Responder Con Cita
  #2  
Antiguo 24-11-2014
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
carlosprotos,

Cita:
Empezado por carlosprotos
...tengo un problema con los Hotkeys en Delphi...cuando le agrego ALT+1 o ALT+K , o tambien CTRL+T , no me funciona la combinación...Quisiera saber si hay alguna función o fuente que me ayude con ese problema...


Revisa este código:
Código Delphi [-]
// Método 1 de Gestión de Combinaciones de Teclas
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   KeyPreview := True;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin

   If (GetKeyState(VK_CONTROL) < 0) and
      (GetKeyState(VK_F1) < 0) and
      (GetKeyState(Ord('7')) < 0)
   then
      MessageDlg('Ctrl + F1 + 7',mtInformation,[mbOK],0);

   if (Shift = [ssCtrl]) and (Key = VK_F7) then
      MessageDlg('Ctrl + F7',mtInformation,[mbOK],0);

   if (Shift = [ssAlt]) and (Key = Ord('N')) then
      MessageDlg('Alt + N',mtInformation,[mbOK],0);

   if (Shift = [ssCtrl]) and (Key = Ord('N')) then
      MessageDlg('Ctrl + N',mtInformation,[mbOK],0);

   if (Shift = [ssAlt]) and (Key = Ord('1')) then
      MessageDlg('Alt + 1',mtInformation,[mbOK],0);

end;

end.
Código Delphi [-]
// Método 2 de Gestión de Combinaciones de Teclas
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    procedure WM_KEYDOWN(var Msg : TMessage); Message WM_KEYDOWN;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WM_KEYDOWN(var Msg : TMessage);
begin

   If (GetKeyState(VK_CONTROL) < 0) and
      (GetKeyState(VK_F1) < 0) and
      (GetKeyState(Ord('7')) < 0)
   then
      MessageDlg('Ctrl + F1 + 7',mtInformation,[mbOK],0);

   If (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_F7) < 0)
   then
      MessageDlg('Ctrl + F7',mtInformation,[mbOK],0);

   If (GetKeyState(VK_MENU) < 0) and (GetKeyState(Ord('N')) < 0) then
      MessageDlg('Alt + N',mtInformation,[mbOK],0);

   If (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(Ord('N')) < 0) then
      MessageDlg('Ctrl + N',mtInformation,[mbOK],0);

   If (GetKeyState(VK_MENU) < 0) and (GetKeyState(Ord('1')) < 0) then
      MessageDlg('Alt + 1',mtInformation,[mbOK],0);

end;

end.
Código Delphi [-]
// Método 3 de Gestión de Combinaciones de Teclas
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure MessageHandler(var Msg: TMsg; var Handled: Boolean);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   Application.OnMessage := MessageHandler
end;

procedure TForm1.MessageHandler(var Msg: TMsg; var Handled: Boolean);
begin

   if (Msg.message = WM_KEYDOWN) then
   begin

      If (GetKeyState(VK_CONTROL) < 0) and
         (GetKeyState(VK_F1) < 0) and
         (GetKeyState(Ord('7')) < 0)
      then
         MessageDlg('Ctrl + F1 + 7',mtInformation,[mbOK],0);

      If (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_F7) < 0)
      then
         MessageDlg('Ctrl + F7',mtInformation,[mbOK],0);

      If (GetKeyState(VK_MENU) < 0) and (GetKeyState(Ord('N')) < 0) then
         MessageDlg('Alt + N',mtInformation,[mbOK],0);

      If (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(Ord('N')) < 0) then
         MessageDlg('Ctrl + N',mtInformation,[mbOK],0);

      If (GetKeyState(VK_MENU) < 0) and (GetKeyState(Ord('1')) < 0) then
         MessageDlg('Alt + 1',mtInformation,[mbOK],0);

   end;

end;

end.
El código anterior en Delphi 7 sobre Windows 7 Professional x32, Muestra 3 métodos de Gestión de Combinaciones de Teclas.

Revisa esta información:
Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 24-11-2014 a las 01:17:25.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Hotkeys en Delphi miguelnoda Varios 9 30-12-2012 07:53:50
teclas calientes (hotkeys) en html gabrielflowers HTML, Javascript y otros 4 14-03-2009 18:54:00
HotKeys Globales: RegisterHotKey chico_bds OOP 7 24-01-2007 18:05:05
Botones hotkeys el_barto Varios 10 30-06-2005 22:19:54
campos llave combinados suppergus Varios 2 03-05-2005 00:32:38


La franja horaria es GMT +2. Ahora son las 21:55:52.


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
Copyright 1996-2007 Club Delphi