Page 1 of 1

my new robot BASIC COMPILER keyboard problem ...

Posted: Thu Apr 29, 2021 10:19 am
by marc_256
Hello,

For my new walking robot, I'm creating a personalized ARDUINO DUE - BASIC COMPILER/DEBUGGER GUI/IDE.
Starting with a text editor.
I use OpenScreen (...) graphic mode for this, so graphically everything is OK, except if I use the keyboard.
The keys ['], ["] and [^] are giving me wrong results ... all others are OK ?
I'm using COURIER NEW 8...12 pnt font for the IDE.
(See the debug file below.)

I use the following program (part of a big one)

Code: Select all

	KeyboardMode (#PB_Keyboard_Qwerty | #PB_Keyboard_International)
	...

	ExamineKeyboard ()

	Keyboard_Key = KeyboardInkey ()
	Keyboard_Key_Value = Asc (Keyboard_Key)

	If Asc (Keyboard_Key) > 0
		Debug "KEY PUSHED : " + Asc (Keyboard_Key) + " <-> CHARACTER : " + Keyboard_Key
	EndIf
How can I change this errors ?
I use PB 5.73 x64 on Win 10 home.

Thanks,
Marc

Image


Image

Re: my new robot BASIC COMPILER keyboard problem ...

Posted: Thu Apr 29, 2021 2:42 pm
by Demivec
marc_256 wrote: Thu Apr 29, 2021 10:19 am

Code: Select all

	KeyboardMode (#PB_Keyboard_Qwerty | #PB_Keyboard_International)
The flags you used for KeyboardMode() should not be combined, they are opposites with the values of 0 and 1. That means using #PB_Keyboard_International will always override #PB_Keyboard_Qwerty:

Code: Select all

#PB_Keyboard_Qwerty         : The keyboard ignores the default language layout and always uses
                              the QWERTY one (default behavior).
#PB_Keyboard_International  : The keyboard uses the default language layout to map the keys (can be 
                              useful for non QWERTY keyboards).

Re: my new robot BASIC COMPILER keyboard problem ...

Posted: Thu Apr 29, 2021 5:13 pm
by infratec
I don't get this keys, I only get the key for the '2' for example, but never for the '"' which is the shifted character of '2'.
How did you get this separated?

Re: my new robot BASIC COMPILER keyboard problem ...

Posted: Thu Apr 29, 2021 5:19 pm
by Fig
It may help you https://www.purebasic.fr/french/viewtop ... er#p194979
You can use a keyboardhook cf Zorro post.

Re: my new robot BASIC COMPILER keyboard problem ...

Posted: Thu Apr 29, 2021 6:13 pm
by marc_256
Hallo,

@ Demivec,
i changed it, thanks, i gone test it in a few minutes.

@ infratec,
on my computers I have a fixed AZERTY keyboard, but I dont like this.
So, when I'm programming I use a external extended QWERTY keyboards :D
Image

@Fig,
I like to compile this program in windows, linux and OS
so i need to stay on only PB syntax.

thanks
marc