Hi,
"Shift" keys are handled differently. When you to to the declaration of TShiftState you'll see:
TShiftStateEnum = (ssShift, ssAlt, ssCtrl,
ssLeft, ssRight, ssMiddle, ssDouble,
// Extra additions
ssMeta, ssSuper, ssHyper, ssAltGr, ssCaps, ssNum,
ssScroll,ssTriple,ssQuad,ssExtra1,ssExtra2);
TShiftState = set of TShiftStateEnum;
And you use it like:
if ssAlt in Shift then
showmessage( 'Yessss. Alt.' ).
(btw. this WON'T work in onkeyup with just the alt key...when you lift alt (ie, keyup) it is no longer down and so is not in "Shift", to see it work do something like alt-a).
or
if [ ssShift, ssCtrl ] * Shift = [] then
showmessage( 'shift or ctrl' );
play around with them, you'll get the results you want.
Also, you probably already know, be sure the form's keypreview property is set to true.
Julius
J?rgen Hestermann wrote 21 lines
According to
http://wiki.lazarus.freepascal.org/LCL_Key_Handling
the "KeyUp" event should be triggered when the Alt-key is released.
But how do I tell this procedure that I want to check for the Alt-key?
The "key" parameter is of type word.
What is the representation of the Alt-key here?
vk_alt does not exist.
And how about the "Shift" parameter?
It would tell me whether Alt is currently pressed or not
but not whether it has been released.
A bit confusing....
Anybody knows how it works?
--
_______________________________________________
Lazarus mailing list
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus