Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Key – PB Docs 126 – PowerBuilder Library

Key – PB Docs 126

Key event

Description

Occurs when the user presses a key.

Event ID

Event ID

Objects

pbm_lvnkeydown

ListView

pbm_renkey

RichTextEdit

pbm_tcnkeydown

Tab

pbm_tvnkeydown

TreeView

pbm_keydown

Window

Parameters

Argument

Description

key

KeyCode by value. A value of the KeyCode
enumerated datatype 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 key

  • 2 Ctrl key

  • 3 Shift and Ctrl keys

Return Values

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 do not know
the current state of the modifier keys until another key is pressed.

Examples

This example causes a beep when the user presses
F1 or F2, as long as Shift and Ctrl are not pressed:

This line displays the value of keyflags when
a key is pressed.

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x