Component: Keyboard (Controls )

From Flowcode Help
Revision as of 13:49, 3 November 2020 by BenR (talk | contribs)
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Controls


Image Keyboard component

Component to allow you to get direct input from the keyboard.

Specific keys can be polled to test if they are pressed and provide interaction with the runtime panel.


A full list of virtual key codes can be found here: https://docs.microsoft.com/en-gb/windows/win32/inputdev/virtual-key-codes?redirectedfrom=MSDN

Examples

Here is an example of how to use the keyboard component to map key pressed to various functions on the panel.

FC6 Icon.png Keyboard Example


You can define keys that can be changed by the user by right clicking the keys in the keyboard component property and exposing them to the top level.

KeyboardExpose.jpg


Once the properties have been exposed you can double click the top level property and rename to give a meaningful name in your application.

KeyboardKeys.jpg


The user can then easily select which key they would like to assign to each function.


Downloadable macro reference

This component does not contain any downloadable macros

Simulation macro reference

GetKeyPress

Checks a single virtual key code to test if the button is pressed or not.

Parameters

BYTE KeyCode
Virtual Key Code Number


Return value

BYTE


CheckMultipleKeys

Checks all of the keys enabled in the component properties.

If any keys are pressed then their scan index number is returned.

If no keys are pressed then 0 is returned.

Parameters

This macro has no parameters


Return value

BYTE



Property reference

Number of Scan Keys

This property is of type Fixed list of ints and can be referenced with the variable name NumKeys.

Sets the number of keys to scan through when calling the CheckMultipleKeys function.

Scan Key 1

This property is of type Fixed list of ints and can be referenced with the variable name ScanKey1.

Virtual Keycode assigned to the scan index

Scan Key 2

This property is of type Fixed list of ints and can be referenced with the variable name ScanKey2.

Virtual Keycode assigned to the scan index

Scan Key 3

This property is of type Fixed list of ints and can be referenced with the variable name ScanKey3.

Virtual Keycode assigned to the scan index

Scan Key 4

This property is of type Fixed list of ints and can be referenced with the variable name ScanKey4.

Virtual Keycode assigned to the scan index