Hi,
when you press CTRL+Q you will obtain two OnKeyDown events. The first with 
Key=17 (it is CTRL) and the second with Key=81 (Q). Both events will have 
ssCtrl in Shift.
 
V.
______________________________________________________________
Od: Jürgen Hestermann <juergen.hesterm...@gmx.de>
Komu: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Datum: 08.02.2017 22:12
Předmět: [fpc-pascal] KeyDown routine and Ctrl+Q

I use a KEYDOWN routine in my main TFORM to check for the key Ctrl+Q:

-----------------------------------------------------------------
procedure TForm1.FormKeyDown(Sender : TObject;
                         var Key    : Word;
                             Shift  : TShiftState);
begin // TForm1.FormKeyDown
case key of
   VK_Q :
      begin
      if Shift=[ssCtrl] then
         begin
         ....
-----------------------------------------------------------------

But when I type "Ctrl+Q" then "Key" is 17 instead of VK_Q (81).

If I now use 17 to trigger the "Q" key, then it is also triggered
when I just type the Ctrl-key (without any other key)!

This is all a bit weird.
How can I detect that "Ctrl+Q" is pressed without
getting fooled by any other key?

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 
<http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to