Differentiate left and right control keys

Post

Posted
Rating:
#1 (In Topic #1342)
Avatar
Regular
Technopeasant is in the usergroup ‘Regular’
Is there anyway using Key.Control to determine if it is the left or the right control key being pressed?
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
You can differentiate using Key.LeftControl and Key.RightControl
(Untested)

Code (gambas)

  1.     If Key.Code=Key.LeftControl then
  2.         ' do something sinister
  3.     Else
  4.         ' do something dextrous
  5.     EndIf
  6.  
Or something like that anyway.

b

Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
 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
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
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
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 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

Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’
 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
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
Seems you can't do it because it's not a qt key code either

the Qt Key class only uses a Key_Control
Qt Namespace | Qt Core | Qt 6.9.2

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 :(

c++ - How to distinguish between left and right modifier keys - Stack Overflow

No clue how to implement any of that  though
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Regular
Technopeasant is in the usergroup ‘Regular’
I am making a very simplistic pinball game, so I guess I will just use control for left flipper and alt for right flipper.
Online now: No Back to the top
1 guest and 0 members have just viewed this.