|
|
|
|
|
- Overview
- Keyboard Variable
- Manage the code of the keys
- Example
- Perform an action in the Key down event
Keyboard Variable (Using physical keyboards on Android)
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.. The Keyboard variable includes the following elements: | | Keyboard.Alt | Boolean Indicates whether the Alt key is pressed when the keyboard event is triggered. | Keyboard.Code | Integer Indicates the code corresponding to the key that triggered the keyboard event. | Keyboard.Ctrl | Boolean Indicates whether the Ctrl key is pressed when the keyboard event is triggered. | Keyboard.Shift | Boolean 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: - 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:
- 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.
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|