Creating Buttons

Creating Buttons

The Button Tool allows you to place a button and define a script that will be executed whenever the button is clicked. When a button is placed on a form, you specify the ID and label of the button, the button's availability, and the MetaScript code that should be executed as the result of a click.

You may, for example, wish to allow a user viewing a Job Ticket in an editing form to print the Job Ticket using a different form specially formatted for printing. In this case, you would add a "Print" button to the editing form, and, using MetaScript, specify that clicking this button prints the displayed Job Ticket using the printing form.

To create a button on a form:

1. Select the Button Tool from the Tools Palette.
2. Move the pointer to the appropriate position, then click and drag to draw a button on the form.
3. Select the newly created button on the form. You can specify the button ID, label, action to perform when the button is clicked, and other control attributes using the Control Palette.

4. In the ID field, type an identifier for the button. Button IDs must be unique within the form. IDs are used to allow the button to be accessed in MetaScript (for example, for the purpose of changing the button's label).
5. In the Label field, type the label you want use for the button. The label will be displayed on the form as the "text" of the button ( ). It is recommended that the label summarize the effects of clicking the button (for example, ).
6. Select the availability of the button from the Availability popup. The determines when the button is disabled (grayed and unavailable to the user) and when it is enabled (can be clicked by the user). The following types of availability may be specified:

Always Enabled---The button will always be enabled.

Enabled During Editing---The button will only be enabled when the record displayed in the form is being edited.

Custom MetaScript---Whether the button is enabled is determined based on a MetaScript calculation. When this type of availability is selected, an Expression field will appear in the dialog, allowing you to specify the MetaScript that should be used; the button will be enabled only when the MetaScript expression evaluates to true. For details on using MetaScript, please refer to the "Using MetaScript to Automate Actions" section.

7. Click the Click Action MetaScript Editor button in the Control Palette. A Click Action Script MetaScript code window will appear, allowing you to define the code that will be executed when the button is clicked. You may also define the MetaScript code in the Click Action field without using the Click Action Script window.

Scripts may include function definitions which may be called from other scripts within the form. For details on functions and commands supported by MetaScript, please refer to the MetaScript Reference manual.

TIP: While in the script editor window, you may use the Database Field button to quickly insert the name of any database field (except the file collector field) or variable placed on the form.

8. Specify the appropriate options for the button. The following options may be specified:

Visibility---indicates whether the button will be always shown, always hidden, shown in print (only when the form is printed), or shown in display (only when the form is viewed in the Job Manager Print Form desktop client).

9. Apply the appropriate attributes (style, size, font) to the new button.
10. Select Save Form from the Form menu to save the changes you have made to the form.

At this point, a new button has been added to the form. You can now continue drawing buttons or move on to the next type of form object you want to place on the form. For details on moving, resizing, copying, or pasting buttons, please refer to the "Working with Form Objects: Supported Actions" section.


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.