Keycode

from Wikipedia, the free encyclopedia

A key code is a code that assigns a number to each individual letter, function , arrow and other key on the computer keyboard . Keycodes release the programmer from the task of interpreting the comparatively complicated scan codes on the keyboard . The actual coding is usually the ASCII - or compatibles Unicode - character encoding ajar, but ultimately always the kernel and / or the program library of each used programming language dependent.

Windows

For example, if the user presses the key combination " Ctrl + S" (in many applications for "Save"), these keystrokes are evaluated in preparation by the program library of the programming language and usually sent to event handling as key code 115 (ASCII coding for the lowercase letter "s") passed on within the program. There the keycode can be evaluated together with further information about the status of the control button and the action provided by the program developer can be triggered. In other cases, the two keys "Strg" and "S" are reported separately as key codes 17 and 83 (ASCII coding for the capital letter "S").

Functions for the provision of key codes exist, for example, in the programming languages Visual Basic and JavaScript .

Linux

The Linux kernel assigns a unique number to each scan code on the keyboard, the so-called "Linux keycode". This assignment depends on the keyboard used and can be setkeycodesmodified using operating system tools ( etc.). Changes require a restart . Keys that have not been assigned a keycode remain completely inoperable.

When using the X Window System (X11), a symbolic name is assigned to each Linux keycode in a second step (English keysym , short for “key symbol”, colloquially also called “X11 keycode”). The numeric key codes are assigned specific symbols , such as letters or other characters from the Unicode character set. This assignment can also be modified, for example with the command line tool xmodmap. Changes are applied without restarting.

Individual evidence

  1. Key Code Constants for Visual Basic 6.0 Users . Microsoft MSDN
  2. keyCode in the SELFHTML Wiki
  3. Doug Palmer: An Unreliable Guide to XKB configuration . As of October 2004.
  4. Ingomar Wesp: Own keyboard layouts in X11 (X.Org / XFree86) . As of January 2008.