i have tried some ways to create a "keyboard controller" which shell be cross-platform usable on windows, linux and mac and shell help to create own input-box gadgets. but i am not happy with that, what i have.
the task is:
- to find out, which keyboard map is currently used by the user (on all os!!). It can be, that the environment language is german, but the user uses an english or french keyboard layout.
- if you hit on a keyboard-key, it shell return the current unicode-number and if you write it in a string, the unicode character shell be written.
- it shell be doable to find out, if one key or several keys are pressed.
there is a keyboard-listener-procedure which will run in the main-loop:
Code: Select all
event.l = WaitWindowEvent()
keyboard_controller()
Code: Select all
Structure keyboard_map
list keys_n.l() ; Here are the unicode numbers of the pressed keys. minimally one.
list keys_s.s() ; Here are the unicode characters. minimally one.
single_key_press.b ; If #False, no need to parse the lists
alt_pressed.b
control_pressed.b
command_pressed.b ; Under Windows and Linux it's the Windows-Popup-Menu-Button, under Mac the Mac-Command-Button
alt_gr_pressed.b
shift_pressed.b
caps_lock_on.b
num_lock_on.b
keymap.s ; Based of the Operating System's current KeyMap, here will be written an universal language id like "de-de-q", "tr-tr-f", "en-us" etc. "q" stands for qwerty-layout,"f" for "f-layout" on keyboard.
EndStructure
Code: Select all
Structure keyboard_user_maps
primary_lid.s ; Primary Language ID
current_lid.s ; The language map, which is currently used
list avai_lids.s() ; All available keymaps of the user
EndStructure
PRIMARY-LANGUAGE + COUNTRY + LAYOUTTYPE. Sample:
DE-DE-Q >> means the germany keymap for germany and in the QWERTZ model.
EN-US-Q >> means the english keymap for usa and in the QWERTY model.
etc.
my problem to work with the keyboard input is:
i don't want to get a virtual key or ascii or ansi or whatever. i only want the unicode-number of a key which is pressed based on the currently using keymap of the system.
i want to find out, how to get an array of all pressed keys within 8ms or in a specific millisecond-bandwidth.
there are some stuff for windows and mac, but not really usable i guess for that, what i want to do. for linux, i have nothing yet.
Till now, i tried to create own maps for each keymap-id on an os. but this is to much work that i cannot do alone. furthermore it is not really useable, because i am also not available to use multi keypress on all three os's.
now i guess it could be a better way to find the unicode-number itself, that fires if a key is pressed. I think, all three os should internally work with unicode. otherwise, i am not sure, how to interact with each keymap.
have someone any idea? maybe better solutions?
kind regards
