[Gambas-user] Detecting Ctrl+another key combinations

Rob sourceforge-raindog2 at ...94...
Thu Jan 3 22:33:41 CET 2008


On Thursday 03 January 2008 16:12, richard terry wrote:
>   TRY CntrlDown = Key.Control
> How does one detect say Ctrl_A or say Shift  + other key
> combinations etc

Well, you could always add

DIM ShiftDown as Boolean
DIM AltDown as Boolean
DIM CtrlShiftDown as Boolean

...

TRY ShiftDown = Key.Shift
TRY AltDown = Key.Alt
CtrlShiftDown = ShiftDown AND CntrlDown 
' etc.

IF (Key.Code = Asc("A")) AND CtrlShiftDown THEN
   ' Ctrl-Shift-A pressed
   ' I don't remember if you're supposed to use uppercase
   ' or lowercase A in the Asc() call above
END IF

They're boolean variables, so you can use boolean operators on them.

You can also use Key.State to get all the modifier keys' states at 
once, but if I'm not mistaken, that's deprecated.

Regarding your post about TextEdit: I looked back in my Gambas list 
archives, and if you posted about that previously using this same 
email address, I didn't receive it.

Rob




More information about the User mailing list