|
 |
|
NOTE: This Design document is subject to change at any time. |
Action
Syntax: <ACTION property-list>Script</ACTION>
Actions are one of the important concepts in zApp. Consider the case where you want to add a "Copy, "Cut", and "Paste" menu to your application. You might want to add these items to your main menu in the "Edit" submenu. You might also want to have toolbar buttons that perform the same function. Perhaps you also want to have these commands in a menu that appears when the user right-clicks on a text box.
It would be a waste to duplicate the code for performing these commands in three different places. An ACTION is a way to centralize these types of commands so that you can use them in multiple places very easily.
In addition to just providing a common script, an action can also be enabled, disabled, checked, and unchecked. For example, the "Copy" action might only be enabled if the user has selected some text in an edit box. A "Bold" action might be checked if the current text selected by the user is already bold, allowing the action to act as a toggle.
To create an action that toggles, be sure to set the initial Checked property to true or false.
In order to be referenced by other components (such as menu items, buttons, etc), an action must have a Name assigned to it.
Actions can also be chained together. One action can refer to another action using the Action property. This is most useful when you want to use one of the built-in actions, but want to add your own processing to that pre-defined action.
An action can also specify the Image to be used (for the toolbar button or menu, for example), and the Caption to be used for the action.
There is an extensive list of pre-defined actions for performing common operations (such as Copy, Cut, Paste, etc). |
|