Problem with Mouse and F10 key ...
Posted: Thu Mar 21, 2024 2:44 pm
Hi,
Problem 1:
For my program, I want to use the keyboard function keys for selection of my SUB programs.
If i use F1...F9 there is no problem and it work very well,
but if I use F10, it blocks the mouse and other Function keys
If I push again F10 all works well ...
PB5.73x64 / Win 10 pro
What is wrong with my program ??
Problem 2:
I use
If KeyboardPushed (#PB_Key_All) ; Check if a key is pushed
this works
for the use of
If KeyboardReleased (#PB_Key_All) ; Check if a key is released
this isn't working ...
can (#PB_Key_All) only be used with KeyboardPushed ?
thanks, marc
Problem 1:
For my program, I want to use the keyboard function keys for selection of my SUB programs.
If i use F1...F9 there is no problem and it work very well,
but if I use F10, it blocks the mouse and other Function keys
If I push again F10 all works well ...
PB5.73x64 / Win 10 pro
What is wrong with my program ??
Problem 2:
I use
If KeyboardPushed (#PB_Key_All) ; Check if a key is pushed
this works
for the use of
If KeyboardReleased (#PB_Key_All) ; Check if a key is released
this isn't working ...
can (#PB_Key_All) only be used with KeyboardPushed ?
thanks, marc
Code: Select all
;--------------------------------------------------------------------------------------------------
;- KEYBOARD FUNCTION KEY TEST
;--------------------------------------------------------------------------------------------------
If InitKeyboard () = 0 Or InitMouse () = 0 Or InitSprite () = 0
; If InitKeyboard () = 0 Or InitSprite () = 0
MessageRequester ("Error", "Can't initialize the Keyboard/Mouse/Sprite system.", 0)
End
EndIf
Global Event.i
Global MouseX.w
Global MouseY.w
Global MouseWheel.w
;--------------------------------------------------------------------------------------------------
If OpenWindow (1, 10, 10, 800, 600, "Keyboard Functionkey test ...", #PB_Window_SystemMenu)
If OpenWindowedScreen (WindowID (1), 0, 0, 800, 600, 0, 0, 0)
ClearScreen ($FF202020)
KeyboardMode (#PB_Keyboard_Qwerty)
Repeat
Repeat
Event = WindowEvent () ;WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
Default
EndSelect
Until Event = 0
FlipBuffers ()
ClearScreen (RGB(0,0,0))
;--------------------------------------------------------------------------------------------------
ExamineKeyboard ()
If KeyboardPushed (#PB_Key_All) ; Check if a key is pushed
If KeyboardPushed (#PB_Key_F1)
Debug "F1 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F2)
Debug "F2 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F3)
Debug "F3 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F4)
Debug "F4 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F5)
Debug "F5 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F6)
Debug "F6 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F7)
Debug "F7 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F8)
Debug "F8 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F9)
Debug "F9 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F10)
Debug "F10 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F11)
Debug "F11 key - pushed"
EndIf
If KeyboardPushed (#PB_Key_F12)
Debug "F12 key - pushed"
EndIf
EndIf
; If KeyboardReleased (#PB_Key_All) ; Check if a key is released
If KeyboardReleased (#PB_Key_F1)
Debug "F1 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F2)
Debug "F2 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F3)
Debug "F3 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F4)
Debug "F4 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F5)
Debug "F5 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F6)
Debug "F6 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F7)
Debug "F7 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F8)
Debug "F8 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F9)
Debug "F9 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F10)
Debug "F10 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F11)
Debug "F11 key - Released"
EndIf
If KeyboardReleased (#PB_Key_F12)
Debug "F12 key - Released"
EndIf
; EndIf
;--------------------------------------------------------------------------------------------------
ExamineMouse ()
MouseX = MouseX ()
MouseY = MouseY ()
MouseWheel = MouseWheel ()
If MouseButton (#PB_MouseButton_Left)
Debug "Mouse button Left - pushed"
ElseIf MouseButton (#PB_MouseButton_Middle)
Debug "Mouse button Middle - pushed"
ElseIf MouseButton (#PB_MouseButton_Right)
Debug "Mouse button Right - pushed"
EndIf
StartDrawing (ScreenOutput ())
DrawingMode (#PB_2DDrawing_Default)
Box (0, 0, 800, 600, $FF101010)
Circle (MouseX, MouseY, 2, $FF0000E0)
StopDrawing ()
;--------------------------------------------------------------------------------------------------
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester ("Error", "Impossible to open a 800*600 32 bit screen", 0)
EndIf
Else
MessageRequester ("Error", "Can't open window", 0)
EndIf
End