About user events
Contents
Windows, user objects, controls, menus, and Application objects
each have a predefined set of events. In most cases, the predefined
events are all you need, but there are times when you want to declare
your own user event. You can use predefined event IDs to trigger a user
event, or you can trigger it exclusively from within your application
scripts.
Features that you might want to add to your application by
creating user events include keystroke processing, providing multiple
ways to perform a task, and communication between a user object and a
window.
Keystroke processing
Suppose that you want to modify the way keystrokes are processed
in your application. For example, in a DataWindow control, you want the
user to be able to press the Down Arrow and Up Arrow keys to scroll
among radio buttons in a DataWindow column. Normally, pressing these
keys moves the focus to the next or preceding row.
To do this, you define user events corresponding to Windows events
that PowerBuilder does not define.
Multiple methods
Suppose that you want to provide several ways to accomplish a
certain task within a window. For example, you want the user to be able
to update the database by either clicking a button or selecting a menu
item. In addition, you want to provide the option of updating the
database when the user closes the window.
To do this, you define a user event to update the database.
Communication between user object and
window
Suppose that you have placed a custom visual user object in a
window and need to communicate between the user object and the window.
For information, see Communicating between a
window and a user object.