Differentiate left and right control keys
- Technopeasant
- Posts: 149
- Joined: Saturday 13th July 2019 6:50pm
- Location: Stony Plain, Alberta, Canada
- Contact:
Differentiate left and right control keys
Is there anyway using Key.Control to determine if it is the left or the right control key being pressed?
Re: Differentiate left and right control keys
You can differentiate using Key.LeftControl and Key.RightControl
(Untested)
Or something like that anyway.
b
(Untested)
If Key.Control then
If Key.Code=Key.LeftControl then
' do something sinister
Else
' do something dextrous
EndIf
EndIf
Or something like that anyway.
b
- BruceSteers
- Posts: 1838
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Differentiate left and right control keys
I don't think it's possible.
The gambas Key.class gives same code for both control keys.
same for Shift
Only Alt keys differentiate as one if Key.AltKey and other is Key.AltGrKey
The gambas Key.class gives same code for both control keys.
same for Shift
Only Alt keys differentiate as one if Key.AltKey and other is Key.AltGrKey
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1838
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Differentiate left and right control keys
It's a shame and certainly limits game control as i discovered on my TurboSnake game.
2 users sharing a keyboard cannot use Shift or Ctrl keys well they can but it's dodgy
2 users sharing a keyboard cannot use Shift or Ctrl keys well they can but it's dodgy
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Differentiate left and right control keys
So why do the constants exist? M Minisini needs to explain.
They definitely have different scan codes (that's the low level code that's received at the OS level). I know that from a looooooooooong time ago and in a far distant galaxy.
It should be possible!
b
They definitely have different scan codes (that's the low level code that's received at the OS level). I know that from a looooooooooong time ago and in a far distant galaxy.
It should be possible!
b
- BruceSteers
- Posts: 1838
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Differentiate left and right control keys
I'm pretty sure they don't m8. (not sure what language that is but i don't think it's gambas)
I only see Key.ControlKey constant
I know you can send with x11 Desktop.SendKey("Control_L")
but there's no way to receive
Key.Code for both control keys are the same and its Key.ControlKey
I only see Key.ControlKey constant
I know you can send with x11 Desktop.SendKey("Control_L")
but there's no way to receive
Key.Code for both control keys are the same and its Key.ControlKey
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1838
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Differentiate left and right control keys
Seems you can't do it because it's not a qt key code either
the Qt Key class only uses a Key_Control
https://doc.qt.io/qt-6/qt.html#Key-enum
there are ways to do it with the QT api but gambas Key.class does not do anything unusual, it only supports what the toolkit Key class supports in respect to Control and Shift Keys
https://stackoverflow.com/questions/112 ... ifier-keys
No clue how to implement any of that though
the Qt Key class only uses a Key_Control
https://doc.qt.io/qt-6/qt.html#Key-enum
there are ways to do it with the QT api but gambas Key.class does not do anything unusual, it only supports what the toolkit Key class supports in respect to Control and Shift Keys
https://stackoverflow.com/questions/112 ... ifier-keys
No clue how to implement any of that though
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- Technopeasant
- Posts: 149
- Joined: Saturday 13th July 2019 6:50pm
- Location: Stony Plain, Alberta, Canada
- Contact:
Re: Differentiate left and right control keys
I am making a very simplistic pinball game, so I guess I will just use control for left flipper and alt for right flipper.