I am unable to detect '#PB_Key_Minus' neither '#PB_Key_PadComma' keys with the keyboard native library.
Is it an issue from my keyboard or is it a general thing?
How to detect #PB_Key_Minus and #PB_Key_PadComma ?
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: How to detect #PB_Key_Minus and #PB_Key_PadComma ?
The question to me is, what are these keys?
The keys on the pad are named: #PB_Key_Subtract and #PB_Key_Decimal
The keys on the pad are named: #PB_Key_Subtract and #PB_Key_Decimal
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: How to detect #PB_Key_Minus and #PB_Key_PadComma ?
Don't you have access to the documentation manual?
Re: How to detect #PB_Key_Minus and #PB_Key_PadComma ?
I have, but what am I supposed to read there?
There is no information about the constants' meaning!
On German keyboard, #PB_Key_Minus is mapped to "ß"-key and but #PB_Key_PadComma?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: How to detect #PB_Key_Minus and #PB_Key_PadComma ?
They look like something to do with the numeric keypad. They're listed here -> https://www.purebasic.com/documentation ... ushed.html
Re: How to detect #PB_Key_Minus and #PB_Key_PadComma ?
I think the keys you are looking for are
test the NUM-Pad Keys with this little helper (borrowed from help Inkey()):
Code: Select all
Debug #PB_Shortcut_Subtract
Debug #PB_Shortcut_Decimal
Code: Select all
If OpenConsole()
PrintN("Press Escape to exit")
Repeat
KeyPressed$ = Inkey()
rkey = RawKey()
If KeyPressed$ <> ""
PrintN("You pressed: " + KeyPressed$)
PrintN("It has a raw code of: " + Str(rkey))
If rkey = #PB_Shortcut_Subtract
PrintN(" Subtract ")
ElseIf rkey = #PB_Shortcut_Decimal
PrintN(" Decimal ") ; only if NUM is active !!!
EndIf
ElseIf rkey
PrintN("You pressed a non ASCII key.")
PrintN("It has a raw code of: " + Str(rkey))
Else
Delay(20) ; Don't eat all the CPU time, we're on a multitask OS
EndIf
Until KeyPressed$ = Chr(27) ; Wait until escape is pressed
CloseConsole() ; ? missing in the help example
EndIf
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).
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).
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: How to detect #PB_Key_Minus and #PB_Key_PadComma ?
Thanks to all of you.
What happens is that manual, in the list pointed by BarryG, should remark that the names are for the english keyboards only.
At the moment i solved it with
What happens is that manual, in the list pointed by BarryG, should remark that the names are for the english keyboards only.
At the moment i solved it with
Code: Select all
ElseIf KeyboardReleased(#PB_Key_Minus) Or KeyboardReleased(#PB_Key_Slash) Or KeyboardReleased(#PB_Key_Subtract):blah blah blah .. ...
ElseIf KeyboardReleased(#PB_Key_PadComma) Or KeyboardReleased(#PB_Key_Decimal) Or KeyboardReleased(#PB_Key_Period):bluh bluh bluh... ... ...