PB's keyboard library and "problematic" keys
Posted: Sat Aug 07, 2010 6:01 pm
Since I'm writing my keyboard sub-library for the lib I'm working on, I had to confront with the numerous quirks of the windows keyboard model.
More infos:
http://blog.ngedit.com/2005/06/13/whats ... put-model/
I'm encountering some problems, and I thought to check if the PB keyboard library solved them in some way or simply ignored them. It seem it simply ignore them, so I'm asking your opinion... it's perfectly ok for you (and so if I do the same it will sound reasonable to you) or do you think something should be done to treat these keys in a different way ?
For the F10 / Left Alt I don't see a way honestly, but for the other... maybe something convoluted can be thought.
Example follow for a couple of the more problematic keys
Try the code as it is, and press F9
then activate (uncomment) the line below and obviously comment out the previous one
try with f10, as you see doesn't work quite right
and then the following one
Try to press the Left Control, all seem ok. But then try to press the Right Alt. Surprise! It's seen like a Left Control.
Now: I know this is "normal". F10 activates a menu or the system menu (try to press f10 and then down arrow to see the system menu appear). Similar thing with Left Alt. About the Right Alt (also known as AltGr) it actually generate two messages, to simulate the ctrl+alt combination. That's why the third version of the "if" works with both keys.
The questions are...
1) Were you expecting the keyboard library to work this way?
2) Is that a problem in your view ?
Please note that when working in full screen than only this case
... is acting "funny".
More infos:
http://blog.ngedit.com/2005/06/13/whats ... put-model/
I'm encountering some problems, and I thought to check if the PB keyboard library solved them in some way or simply ignored them. It seem it simply ignore them, so I'm asking your opinion... it's perfectly ok for you (and so if I do the same it will sound reasonable to you) or do you think something should be done to treat these keys in a different way ?
For the F10 / Left Alt I don't see a way honestly, but for the other... maybe something convoluted can be thought.
Example follow for a couple of the more problematic keys
Code: Select all
OpenWindow(0,10,10,600,400,"KEYB")
ButtonGadget(1, 450,10, 100, 30, "keyb")
If InitSprite() And InitKeyboard() And OpenWindowedScreen(WindowID(0),0,0,400,300,0,0,0)
Paused = #False
Repeat
iEvent = WindowEvent()
FlipBuffers()
If StartDrawing(ScreenOutput())
ExamineKeyboard()
If KeyboardReleased(#PB_Key_F9) ; all ok
; If KeyboardReleased(#PB_Key_F10) ; press f10 and see what happen, then try f10 and down arrow to show the system menu
; If KeyboardReleased(#PB_Key_LeftControl) ; press right alt instead !
; If KeyboardReleased(#PB_Key_LeftAlt) ; problem similar to F10
If Paused = #False
Paused = #True
Else
Paused = #False
EndIf
EndIf
DrawingMode(0)
If Paused = #False
DrawText(20, 20, "Program is running...")
Else
DrawText(20, 20, "Program paused... ")
EndIf
StopDrawing()
EndIf
Until KeyboardPushed(#PB_Key_Escape) Or iEvent = #PB_Event_CloseWindow
EndIf
Code: Select all
If KeyboardReleased(#PB_Key_F9) ; all ok
Code: Select all
If KeyboardReleased(#PB_Key_F10)
and then the following one
Code: Select all
If KeyboardReleased(#PB_Key_LeftControl)
Now: I know this is "normal". F10 activates a menu or the system menu (try to press f10 and then down arrow to see the system menu appear). Similar thing with Left Alt. About the Right Alt (also known as AltGr) it actually generate two messages, to simulate the ctrl+alt combination. That's why the third version of the "if" works with both keys.
The questions are...
1) Were you expecting the keyboard library to work this way?
2) Is that a problem in your view ?
Please note that when working in full screen than only this case
Code: Select all
If KeyboardReleased(#PB_Key_LeftControl) ; press right alt instead !