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 need 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, communication between a user object and a window, and the ability to perform a task in multiple ways.
Suppose you want to modify the way keystrokes are processed in your application. For example, in a DataWindow control, suppose 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 make this change, you can define user events corresponding to operating system events that PocketBuilder does not define.
Suppose 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.
Suppose you have placed a custom visual user object in a window and need to pass information between the user object and the window. You can create a user event that communicates this information either synchronously or asynchronously.
For more information, see “Communicating between a window and a user object”.