Help / Developing for Android
  • Overview
  • Keyboard Variable
  • Manage the code of the keys
  • Example
  • Perform an action in the Key down event
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
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.
Remark: This variable can be used in Simulator mode.
Keyboard Variable
The Keyboard variable includes the following elements:
Indicates whether the Alt key is pressed when the keyboard event is triggered.
Indicates the code corresponding to the key that triggered the keyboard event.
Indicates whether the Ctrl key is pressed when the keyboard event is triggered.
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 (subdirectory "Personal\\External"). To include this file in your applications, you need to use the EXTERN keyword as follows:
  2. Then use the desired constants with the variable Keyboard.code:
    IF Keyboard.Code = VK_Space THEN
  • 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 displayed by the code completion in the code editor from the moment the file has been integrated with the EXTERN keyword.

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")
Minimum version required
  • Version 24
Click [Add] to post a comment

Last update: 06/12/2023

Send a report | Local help