[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'keyboard' (#rtl)

GetKeyEventShiftState

Return the current state of the shift keys.

Declaration

Source position: keybrdh.inc line 183

function GetKeyEventShiftState(

  KeyEvent: TKeyEvent

):Byte;

Description

GetKeyEventShiftState returns the shift-state values of the given KeyEvent. This can be used to detect which of the modifier keys Shift, Alt or Ctrl were pressed. If none were pressed, zero is returned.

Note that this function does not always return expected results; In a unix X-Term, the modifier keys do not always work.

Errors

None.

See also

GetKeyEventUniCode

  

Return the unicode key event.

GetKeyEventFlags

  

Extract the flags from a key event.

GetKeyEventCode

  

Translate function key part of a key event code.

GetKeyEventChar

  

Get the character key part of a key event.

GetKeyEvent

  

Get the next raw key event, wait if needed.

Example

Program Example3;

{ Program to demonstrate the GetKeyEventShiftState function. }

Uses keyboard;

Var
  K : TKeyEvent;
  S : Byte;

begin
  InitKeyBoard;
  Write('Press keys combined with CTRL/SHIFT/ALT');
  Writeln(', or press "q" to end.');
  Repeat
    K:=GetKeyEvent;
    K:=TranslateKeyEvent(K);
    S:=GetKeyEventShiftState(K);
    If (S=0) then
      Writeln('No special keys pressed')
    else
      begin
      Writeln('Detected special keys : ',ShiftStateToString(K,False));
      Writeln('Got key : ',KeyEventToString(K));
      end;
  Until (GetKeyEventChar(K)='q');
  DoneKeyboard;
end.

Documentation generated on: Mar 17 2017