Page 1 of 2

Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 2:44 pm
by marc_256
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



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

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 3:15 pm
by Mesa
Everything works finehere with windows10 pb6.10b8x64.

Maybe something wrong with your keyboard or you may have a keyboard manager somewhere.

M.

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 3:20 pm
by Axolotl
Hi marc_256
marc_256 wrote: Thu Mar 21, 2024 2:44 pm .... 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 ??
A cautious attempt: in windows, the F10 key is used to (de)activate the menu. So pressing F10 activates the menu, pressing F10 again deactivates the menu.
Whatever happens when there is no menu at all......

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 3:29 pm
by Axolotl
yeah,
now I tested the program, it worked as expected. (F9 and F10 doing exactly the same thing:)
So maybe your keyboard setting is different. Happend sometimes on Laptops/Notebooks with this media key things .....

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 3:43 pm
by breeze4me
I tested and I have the same problem with PB 5.73 x64, but 6.10 b8 has no problem.
This seems to be a bug in 5.73.

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 4:01 pm
by marc_256
Hi guys,

yes it is a windows MENU stuff,
I tested it with Firefox and there F10 activates the MENU.
and after pushing F10 again, I return to Firefox

Only,
I do not activate the window keys in my Keyboard setting.
#PB_Keyboard_AllowSystemKeys:
The 'OS' system keys are allowed (like Win+R etc.).
This can be annoying in fullscreen mode if the user presses on them accidentally.
I only use:
KeyboardMode (#PB_Keyboard_Qwerty)

marc,

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 21, 2024 5:08 pm
by Quin
Can confirm it happens for me on 5.73 on Windows 10, but not 6.10 B8. Probably one of the many, many bugs that got fixed in the 6.0x bug smashing marathon.

Re: Problem with Mouse and F10 key ...

Posted: Wed Mar 27, 2024 5:12 pm
by charvista
No problem on PB 6.04 LTS either.

Re: Problem with Mouse and F10 key ...

Posted: Wed Mar 27, 2024 6:47 pm
by marc_256
@Quin and charvista

thanks for testing,
Now I only need to find a way to block this problem with PB5.73 x64 on windows

Are here any window gurus who can help me ?

Marc,

Re: Problem with Mouse and F10 key ...

Posted: Wed Mar 27, 2024 7:12 pm
by Caronte3D
Why not update PB? :?:

Re: Problem with Mouse and F10 key ...

Posted: Wed Mar 27, 2024 7:56 pm
by mk-soft
I still work on old projects with old versions, because sometimes the effort is too great to adapt all external libraries, or they no longer exist.

New projects of cource with new version ..

Re: Problem with Mouse and F10 key ...

Posted: Wed Mar 27, 2024 8:43 pm
by marc_256
Hi, Caronte3D

I started with the PB demo version about 15 years back now ...
Every time I updated PB to a new version it cost me a lot of time to adapt all my programs (weeks...)
Even commands who are not followed up, or have no alternative solution.

For my CAD/CAM/CNC 2D/3D programs I love PB5.72 x64 the most and PB5.73 x64 for other programs.
It depends I use full Screen mode or not.
I decided to use PB5.72/PB5.73 for some time.

But what is the meaning of LTS version as they are abandoned after some time.
What is LTS, what is the time weeks, months, one year ??

So, I need to find solutions for my MegaBytes of source codes.

And also for this F10 problem ...

thanks,
marc

Re: Problem with Mouse and F10 key ...

Posted: Wed Mar 27, 2024 8:49 pm
by Caronte3D
I understand your reasons and they are understandable.
I'm sorry I can't help you with the F10 thing.

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 28, 2024 9:15 am
by breeze4me
marc_256 wrote: Thu Mar 21, 2024 2:44 pm 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
Try this.

Code: Select all

Procedure WndProc(hwnd, message, wparam, lparam)
  
  If message = #WM_SYSCOMMAND And wparam = #SC_KEYMENU
    ProcedureReturn 0
  EndIf
  
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

;--------------------------------------------------------------------------------------------------
	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)
			
			SetWindowCallback(@WndProc())        ;  <---
			
                        ......

Re: Problem with Mouse and F10 key ...

Posted: Thu Mar 28, 2024 10:31 am
by Shardik
marc_256 wrote: But what is the meaning of LTS version as they are abandoned after some time.
What is LTS, what is the time weeks, months, one year ??
Fred explained LTS in this blog entry.