TSDL_KeyboardEvent

Name

   TSDL_KeyboardEvent -- Keyboard event structure

Structure Definition

  TSDL_KeyboardEvent = record
type_: UInt8; // SDL_KEYDOWN or SDL_KEYUP
which: UInt8; // The keyboard device index
state: UInt8; // SDL_PRESSED or SDL_RELEASED
keysym: TSDL_KeySym;
end;

Structure Data

type SDL_KEYDOWN or SDL_KEYUP
state SDL_PRESSED or SDL_RELEASED
keysym Contains key press information

Description

TSDL_KeyboardEvent is a member of the TSDL_Event union and is used when an event of type SDL_KEYDOWN or SDL_KEYUP is reported.

The type and state actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released ( type=SDK_KEYUP or state=SDL_RELEASED) and when a key is pressed (type= SDL_KEYDOWN or state= SDL_PRESSED ). The information on what key was pressed or released is in the keysym structure.

Note: Repeating SDL_KEYDOWN events will occur if key repeat is enabled (see SDL_EnableKeyRepeat).

See Also

TSDL_Event   , TSDL_KeySym   , SDL_EnableKeyRepeat   , SDL_EnableUNICODE