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

# FunctionKeyName

Return string representation of a function key code.

## Declaration

Source position: keybrdh.inc line 198

`function FunctionKeyName(`
`KeyCode: Word`
`):string;`

## Description

FunctionKeyName returns a string representation of the function key with code KeyCode. This can be an actual function key, or one of the cursor movement keys.

## Errors

In case KeyCode does not contain a function code, the SUnknownFunctionKey string is returned, appended with the KeyCode.

## See also

ShiftStateToString |  | Return description of key event shift state
KeyEventToString |  | Return a string describing the key event.

## Example

    Program Example8;

    { Program to demonstrate the FunctionKeyName function. }

    Uses keyboard;

    Var
      K : TkeyEvent;

    begin
      InitKeyboard;
      Writeln('Press function keys, press "q" to end.');
      Repeat
        K:=GetKeyEvent;
        K:=TranslateKeyEvent(K);
        If IsFunctionKey(k) then
          begin
          Write('Got function key : ');
          Writeln(FunctionKeyName(TkeyRecord(K).KeyCode));
          end;
      Until (GetKeyEventChar(K)='q');
      DoneKeyboard;
    end.

Documentation generated on: May 14 2021