Problem with Mouse and F10 key ...

Just starting out? Need help? Post your questions and find answers here.
marc_256
Addict
Addict
Posts: 857
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Problem with Mouse and F10 key ...

Post 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
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
Mesa
Enthusiast
Enthusiast
Posts: 447
Joined: Fri Feb 24, 2012 10:19 am

Re: Problem with Mouse and F10 key ...

Post by Mesa »

Everything works finehere with windows10 pb6.10b8x64.

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

M.
Axolotl
Addict
Addict
Posts: 873
Joined: Wed Dec 31, 2008 3:36 pm

Re: Problem with Mouse and F10 key ...

Post 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......
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Axolotl
Addict
Addict
Posts: 873
Joined: Wed Dec 31, 2008 3:36 pm

Re: Problem with Mouse and F10 key ...

Post 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 .....
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: Problem with Mouse and F10 key ...

Post 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.
marc_256
Addict
Addict
Posts: 857
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Problem with Mouse and F10 key ...

Post 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,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Problem with Mouse and F10 key ...

Post 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.
User avatar
charvista
Addict
Addict
Posts: 949
Joined: Tue Sep 23, 2008 11:38 pm
Location: Belgium

Re: Problem with Mouse and F10 key ...

Post by charvista »

No problem on PB 6.04 LTS either.
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
marc_256
Addict
Addict
Posts: 857
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Problem with Mouse and F10 key ...

Post 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,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Caronte3D
Addict
Addict
Posts: 1371
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Problem with Mouse and F10 key ...

Post by Caronte3D »

Why not update PB? :?:
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Problem with Mouse and F10 key ...

Post 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 ..
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
marc_256
Addict
Addict
Posts: 857
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Problem with Mouse and F10 key ...

Post 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
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Caronte3D
Addict
Addict
Posts: 1371
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Problem with Mouse and F10 key ...

Post by Caronte3D »

I understand your reasons and they are understandable.
I'm sorry I can't help you with the F10 thing.
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: Problem with Mouse and F10 key ...

Post 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())        ;  <---
			
                        ......
User avatar
Shardik
Addict
Addict
Posts: 2067
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Problem with Mouse and F10 key ...

Post 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.
Post Reply