Form.KeyDown Event
The KeyDown event is triggered by pressing the keyboard. By processing the KeyDown event in the OnKeyDown event handler, you can express the behavior like an accelerator.
The following child objects are attached to the Event object.
| Type | Name | Description |
|---|---|---|
| Number | ShiftKey | 1 if the Shift key is pressed, 0 otherwise |
| Number | CtrlKeyKey | 1 if the Ctrl key is pressed, 0 otherwise |
| Number | AltKey | 1 if the Alt key is pressed, 0 otherwise |
| String | Key | Pressed key See the table below for special keys. |
Example of use
Function OnKeyDown(e) {
if (e.CtrlKey == 1 && e.Key == "G") {
/* Ctrl+Gを押したときForm2に画面を切り替えます */
//.Form1.Delete();
//.Get("Form2.crs");
}
}
Value stored in the Key object (special key)
| Key Type | Stored Value |
|---|---|
| Esc | "ESCAPE" |
| BackSpace | "BACK" |
| Tab | "TAB" |
| ENTER | "RETURN" |
| change | "CONVERT" |
| No conversion | "NONCONVERT" |
| Space | "SPACE" |
| Insert. Insert. | "INSERT" |
| Home | "HOME" |
| PageUp | "PRIOR" |
| Delete | "DELETE" |
| End | "END" |
| PageDown | "NEXT" |
| Direction key left | "LEFT" |
| On the arrow keys | "UP" |
| Direction key right | "RIGHT" |
| Down arrow keys | "DOWN" |
| Pause Break | "PAUSE" |
| Left Windows key | "LWIN" |
| Right Windows key | "RWIN" |
| Numeric keypad 0-9 _ | "NUMPAD0" to "NUMPAD9" |
| Numeric keypad. | "DECIMAL" |
| Numeric keypad * | "MULTIPLY" |
| Numeric keypad + | "ADD" |
| Numeric keypad / | "DIVIDE" |
| Numeric keypad- | "SUBTRACT" |
| NumLock | "NUMLOCK" |
| F1 ~ F24 | "F1" - "F24" |
| Scroll Lock | "SCROLL" |
For the KeyDown event, the type of key operation that occurs and the object that is the source of the event are determined by which object the keyboard focus is on in the Biz / Browser screen.
The source object for the KeyDown event is the Form object in which the object is located, if the object has keyboard focus. If the keyboard focus is not on any object, it originates from the top Form object.
Priority order for key operations
When multiple meanings are assigned to one key operation and the key operation is actually performed, the priority order of execution is as follows.
-
For key operations set in the Tab key, Shift + Tab key, NextTabKey property, and PrevTabKey property, focus movement is performed preferentially.
-
Object-specific key operations are performed.
-
The key operation assigned to the AltKey property of the Button object is executed.
-
The KeyDown event is raised.
- The operation that occurs in one key operation is one of focus movement, object-specific operation, AltKey property operation, and KeyDown event issuance.
Precautions when using the KeyDown event
-
It is recommended not to use special keys (Kanji, no conversion, BackSpace , etc.) used for character input in the KeyDown event because they are strongly affected by the type of IME and the state of the object.
-
It is recommended not to use the same key as the system key (system menu Alt + Space , window switching Alt + Tab , etc.) as it may cause confusion in operability.
-
It is recommended that you do not use keys that have unique meanings, such as PrintScreen and Pause , as they can cause confusion.
-
The KeyDown event occurs for key operations recognized by Windows . Windows keystroke recognition is affected by keyboard hardware. For example, there is a model in which the NumLock key and the ScrollLock key are used together with one button and selected with the Shift key. Shift + ScrollLock does not occur on these keyboards .
-
Depending on the model, special keys such as Pause and NumLock may be recognized as different keys when pressed at the same time as the Ctrl , Shift , and Alt keys. When using these special keys, make sure that the KeyDown event is fired correctly on the keyboard you are actually using .
-
The KeyDown event may not occur depending on the type of object that is focused on the key press.
Restrictions on Android version
In the Android version, there are restrictions on the objects that generate key events and the keys that can be used.
For details , refer to the Android Version Features and Restrictions.