Macros provide a way to associate a name with a group of valid Nexaweb page instructions (XModify, MCO, data, and so forth) that the Nexaweb platform loads into memory and executes at any time.
When used to develop client side logic, macros provide the following benefits:
No roundtrips to the server required
Portability for future Nexaweb client environments
When using macros, keep in mind the following:
Macro names must be unique. If you create a new macro with the same name as an existing macro, the new macro overwrites the old macro.
Nexaweb translates whatever Nexaweb page instructions you include in a macro into a string and formats it using java.text.message format, so the Nexaweb page instructions in your macro must conform to java.text.message format syntax, for example, to conform to java.text.message format syntax, you must escape single ticks and curly brackets in your Nexaweb page instructions.
For more information on macros, see the Nexaweb Platform documentation.
To use the Nexaweb Studio Macro wizard to create a Macro, follow these steps:
1. To start the Macro wizard, with a UI file open in the Nexaweb perspective, either:
- Select Tools > Create Macro.
- Right click in a UI file and select New > Macro.
- Click
, the Macro wizard icon in the toolbar.
Note: To make the Macro wizard icon available on the Nexaweb Studio toolbar, you must add the Nexaweb Advanced Formatting tools. See Nexaweb Studio Toolbars.
The Macro wizard appears.
2. Begin defining the macro as follows:
|
Figure 33: New Macro wizard. |
Macro Name: Specify a unique name for this macro. (If you create a new macro with the same name as an existing macro, the new macro overwrites the old one.) Document: Leave blank for the specified XModify command to execute against the UI document. Or specify the name of another document - for example, a data document - against which to execute this XModify command. Available Actions: modifications defines a new macro. macroCall Specifies tags in the UI to execute an existing marco. execute Specfies an MCO event call to an existing macro. Either: - Double click on an action, or - Select an action and click Add. The selected action appears in the Defined Action list box. See the following sections for: modifications, macroCall or execute to complete the macro wizard. |