Events and scripts
Applications are event-driven: users control the flow of the
application by the actions they take. When a user clicks a button,
chooses an item from a menu, or enters data into a text box, an event
is triggered. You write scripts that specify the processing that
should happen when the event is triggered.
For example, buttons have a Clicked event. You write a script
for a button’s Clicked event that specifies what happens when the user
clicks the button. Similarly, edit controls have a Modified event that
is triggered each time the user changes a value in the control.
You write scripts using PowerScript, the PowerBuilder language,
in a Script view in the painter for the object you are working on.
Scripts consist of PowerScript functions, expressions, and statements
that perform processing in response to an event. The script for a
button’s Clicked event might retrieve and display information from the
database; the script for an edit control’s Modified event might
evaluate the data and perform processing based on the data.
Scripts can also trigger events. For example, the script for a
button’s Clicked event might open another window, which triggers the
Open event in that window.