Creating an Action Script for a Button on a Form

Description

The scripts we've been working with so far are not associated with any particular "events." To run the "Lesson1" script, you double-click it in the Control Panel. This script is called a Global Script because it can be run at any time.

Some of the examples in this guide require the "Learning Action Scripting" workspace. See Creating Your First Action Script to learn how to get the "Learning Action Scripting" workspace installed.

However, consider this scenario: You create a form and put a button on it. When the user clicks the button, you would like a script to run. When the user clicks the button, the button's OnClick event fires. Alpha Anywhere lets you automatically run a script whenever an event is fired. A script that runs when an event occurs is called an Event Script.

You can attach scripts to a variety of events. For example, a form's OnSave event fires when a record is saved, or its OnActivate event fires when the form receives focus. Refer to Field Rule Field Events and Field Rule Record Events for a full list of events.

In this lesson you are going to focus on the most common event, a button's OnPush event.

Limitations

Desktop Applications Only