[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'InterfaceBase' (#lcl)

# TWidgetSet.GetKeyState

The status of a virtual key.

## Declaration

Source position: winapih.inc line 131

`public function TWidgetSet.GetKeyState(`
`nVirtKey: Integer`
`):SmallInt; virtual;`

## Arguments

`nVirtKey` |  | The virtual key code.

## Function result

The key state flags.

## Description

The result reflects the message processing state, at the time of the last seen key message.

A key can be up, down or toggled.

The high order bit of the result is the up/down state, 1 for down.

The low order bit of the result is the toggled state, applicable to e.g. the caps-lock key. The bit is set if the key is toggled (active).