[Lazarus] how to handle Shift=[ssCtrl]

Vojtěch Čihák vojtech.cihak at atlas.cz
Thu Apr 2 13:54:40 CEST 2015


Hi,
 
You must use:
if ssCtrl in Shift then ...
instead.
 
That's because mouse-buttons are in Shift too. If you do Ctrl+right-click, then Shift=[ssRight, ssCtrl]. And possibly something else (ssCaps).
 
V.
______________________________________________________________
> Od: FreeMan <freeman35 at delphiturkiye.com>
> Komu: Lazarus mail list <Lazarus at lists.lazarus.freepascal.org>
> Datum: 02.04.2015 13:37
> Předmět: [Lazarus] how to handle Shift=[ssCtrl]
>
fpc r30400 lazarus r48585 yosemite qt x64

procedure TFRM_.TLabel1_MouseUp(Sender: TObject; Button: TMouseButton; 
Shift: TShiftState; X  , Y: Integer);
begin
if(Button=mbRight)then begin
   if Shift=[ssCtrl] then begin
    ShowMessage('ctrl key pressed :');
   end;
end;
end;

while debuging, move mouse on "Shift" and hint show values is 128, 
ssCtrl values is SSCTRL. and its not aqual, I mean I can not handle ctrl 
+ right click on Tlabel.
command key = 4
ssctrl =128
ssAlt = 2
ssShift = 1
ssctrl + ssAlt = 130
some shift values from hint

--
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150402/34f9db30/attachment-0003.html>


More information about the Lazarus mailing list