Event ID
Event ID Objects
pbm_lvnkeydown ListView
pbm_renkey RichTextEdit
pbm_tcnkeydown Tab
pbm_tvnkeydown TreeView
pbm_keydown Window
Arguments
Argument Description
key KeyCode by value A value of the KeyCode enumerated data type indicating the key that was pressed (for example, KeyA! or KeyF1!)
keyflags UnsignedLong by value (the modifier keys that were pressed with the key) Values are:1 shift key2 ctrl key3 shift and ctrl keys
Return value
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
1 Do not process the key (RichTextEdit controls only)
Usage
Some PowerBuilder controls capture keystrokes so that the window is prevented from getting a Key event. These include ListView, TreeView, Tab, RichTextEdit, and the DataWindow edit control. When these controls have focus you can respond to keystrokes by writing a script for an event for the control. If there is no predefined event for keystrokes, you can define a user event and associate it with a pbm code.
For a RichTextEdit control, pressing a key can perform document formatting. For example, ctrl+b applies bold formatting to the selection. If you specify a return value of 1, the document formatting associated with the key will not be performed.
If the user presses a modifier key and holds it down while pressing another key, the Key event occurs twice: once when the modifier key is pressed and again when the second key is pressed. If the user releases the modifier key before pressing the second key, the value of keyflags will change in the second occurrence.
When the user releases a key, the Key event does not occur. Therefore, if the user releases a modifier key, you don't know the current state of the modifier keys until another key is pressed.