PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Overview
  • Keyboard Variable
  • Manage the code of the keys
  • Example
  • Perform an action in the Key down event
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The Keyboard variable makes it possible to retrieve the parameters of the events of a physical keyboard. Indeed, an Android device can have a physical keyboard, or can be connected to a physical keyboard (through the Samsung DeX system for example).
This variable must be used only in events related to the physical keyboard:
  • Key down (WM_KEYDOWN),
  • Key up (WM_KEYUP).
On Android, these two events are called only if they are triggered by a keyboard event coming from a physical keyboard.
On Chrome OS, these two events are not called.
Note: This variable can be used in Simulator mode.
Keyboard Variable
The Keyboard variable includes the following elements:
Keyboard.AltBoolean
Indicates whether the Alt key is pressed when the keyboard event is triggered.
Keyboard.CodeInteger
Indicates the code corresponding to the key that triggered the keyboard event.
Keyboard.CtrlBoolean
Indicates whether the Ctrl key is pressed when the keyboard event is triggered.
Keyboard.ShiftBoolean
Indicates whether the Shift key is pressed when the keyboard event is triggered.

Manage the code of the keys

To manage the code of the keys:
  1. Include the KeyConst.WL file in your project. This file associates a specific constant with each keyboard key. This file can be found in the directory WINDEV/WEBDEV/WINDEV Mobile (sub-directory "Personal\External"). To integrate this file into your applications, it is necessary to use the keyword EXTERN as follows :
    EXTERN "KEYCONST.wl"
  2. Then use the desired constants with the variable Keyboard.code:
    IF Keyboard.Code = VK_Space THEN
    ...
    END
Notes:
  • To manage character keys, simply use the ASCII code of that character (returned by Asc).
  • All the constants found in the KeyConst.WL file start with the letters VK_. These constants are proposed by the autocomplete function in the code editor from the moment the file has been integrated with the keyword EXTERN.
Example

Perform an action in the Key down event

The following code is used to perform an action in the "Key down" event of an edit control when using Ctrl + V.
IF Keyboard.Code = VK_V _AND_ Keyboard.Ctrl THEN
Info ("Ctrl V used")
...
END
Minimum version required
  • Version 24
Comments
Click [Add] to post a comment