Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FifteenWindows/OS Functions (continued)

IsKeyPressed Function

Overview

The IsKeyPressed function tests a specified virtual key as being pressed or down on the keyboard.

Syntax/Parameters

Syntax

boolean = IsKeyPressed ( int vkey );

Parameters

vkey

An int specifying a virtual key position. The VK_ keys can be found in the SDK listed in Appendix A — Legato SDK Standard Definitions.

Return Value

Returns a boolean value as TRUE if the specified key is down or FALSE if it is not.

Remarks

The IsKeyPressed function asynchronously reads the keyboard without regard to which application has keyboard focus. It also does not remove the key, or interfere with, the keyboard message queue. It is not meant to perform general keyboard input but rather allow a script to peek at the state of the keyboard.

The return value specifies whether the key was pressed since the last call to IsKeyPressed, and whether the key is currently up or down.

The IsKeyPressed function also works with mouse buttons. However, it checks on the state of the physical mouse buttons, not on the logical mouse buttons that the physical buttons are mapped to. For example:

if (IsKeyPressed(VK_LBUTTON)) { ...

always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button.

Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of operating systems, another application can read the keyboard state and receive the “recently pressed” bit instead of your application.

Scripts can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vkey parameter. This gives the state of the Shift, Ctrl, or Alt keys without distinguishing between left and right. You can use the following virtual-key code constants as values for vkey to distinguish between the left and right instances of those keys.

Certain functions, such as for the progress display will read keys such as Escape and perform certain actions such as returning ERROR_CANCEL.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic