ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing for Android
  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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.
Remark: 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 (subdirectory "Personal\External"). To include this file in your applications, you need to use the EXTERN keyword as follows:
    EXTERN "KEYCONST.wl"
  2. Use the desired constants with the Keyboard.Code variable:
    IF Keyboard.Code = VK_Space THEN 
    ...
    END
Remarks:
  • 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.
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

Last update: 09/08/2023

Send a report | Local help