1.3.2 UI Macros

User Interface (UI) Macros are command routines that respond to user interaction and change the state of the UI. They can be used to perform a variety of actions, including navigating among forms, validating and verifying user input, and filtering records that are shown in the forms. Important features of UI Macros include expressions, filters, and the ability to implement conditional logic. A UI Macro can exist as a standalone object with a name or as an embedded macro that is part of a form. Macros that are part of a form are triggered by events that occur on the form or on a control on the form.

An example of application logic is the use of UI Macros to respond to user input in a search field. After the user modifies the contents of a search box and navigates to a different control, a UI Macro can be triggered that applies a filter to a list of items, such as a list box or a subform, which limits the records displayed in the list to those containing the search term.

Another example is the use of UI Macros to implement navigation functionality, such as drill-through behavior on a form. After an item in a list box is double-clicked, a UI Macro can be triggered that launches a new form, which displays details of the selected item, such as information from a related data source.

This protocol specifies UI Macros using the CT_UserInterfaceMacro type (section 2.2.3.43). Both embedded and standalone UI Macros can specify a Statements element, which specifies commands that will be performed when the Macro is run. Embedded Macros also specify the Event attribute, which specifies when the Macro will be triggered, and the optional For attribute if the Macro will be triggered by the event of a control on the form, as opposed to an event of the form itself.