ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage properties / Properties associated with windows, pages and controls
  • Managing all the keyboard keys
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
The ShortcutKey property gets and sets the keyboard shortcut associated with a control or menu option.
Example
// To be included in the declaration of the global variables of the window
EXTERN "KEYCONST.wl"

BTN_BUTTON1.ShortcutKey = skControl + skShift + Asc("U") // Ctrl + Shift + U
BTN_BUTTON1.ShortcutKey = skControl + VK_F1		// Ctrl + F1
// To be included in the declaration of the global variables of the window
EXTERN "KEYCONST.wl"

OPT_Manage_Suppliers..ShortcutKey = VK_F2
OPT_Manage_Users..ShortcutKey = skAlt + Asc("U")
Syntax

Getting the keyboard shortcut associated with a control or menu option Hide the details

<Result> = <Element used>.ShortcutKey
<Result>: Integer
Shortcut key associated with the control.
<Element used>: Control name
Name of the element used:
  • Name of a control,
  • WINDEVWindowsLinux Name of a menu option.

Changing the keyboard shortcut associated with a control or menu option Hide the details

<Element used>.ShortcutKey = <New shortcut>
<Element used>: Control name
Name of the element used:
  • Name of a control,
  • WINDEVWindowsLinux Name of a menu option.
<New shortcut>: Integer constant
Shortcut key associated with the control. This key can correspond to one of the following elements or to a combination of the following elements:
  • Control keys:
    skAltAlt key.
    skControlCtrl key.
    skShiftShift key.
  • Specific control keys: Additional constants are available in the "KeyConst.wl" file. These constants are used to identify all the keyboard keys. This file is available in the "Personal\External" subdirectory of WINDEV or WINDEV Mobile.. For more details, see remarks.
  • Character keys: Simply use the ASCII code of the character (returned by Asc).
Remarks

Managing all the keyboard keys

To manage all the keys with the ShortcutKey property:
  1. Include the KeyConst.WL file in your project. This file associates a specific constant with each keyboard key. This file is available in the \Personal\Extern directory of WINDEV. To include this file in your applications, you need to use the EXTERN keyword as follows:
    EXTERN "KEYCONST.wl"
  2. Use the constants in the ShortcutKey property:
    cControl is Control <- ControlCreate("BTN_Button", typButton, 6, 60, 160, 30, false)
    cControl.ShortcutKey = skAlt + skShift + VK_F10
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.
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/12/2024

Send a report | Local help