Macro Items

A dialog box can contain macros. These macros are called macro items, because they are macros that are defined like dialog box items. A macro item is similar to a separate macro resource except that:

  • A macro item can only be called by a RunMacro() statement in the same dialog box

  • A macro item can make use of or set the value of any variable that appears anywhere in the dialog box

  • A macro item cannot receive arguments (all variables in the dialog box can be used directly)

  • A macro item cannot return values to the place at which the macro was called (all variables in the dialog box can be set directly)

When Return() is called from a macro item, the dialog box is closed, and the return values are passed to the RunDbox() statement that invoked the dialog box.

The format of a macro item definition is:

Macro "item name" do

<statements go here>

endItem

The item name and do ... endItem section of a macro item are required. You invoke a macro item from another dialog box item within the same dialog box with RunMacro(); you cannot invoke it from outside the dialog box.

For example:

Macro "process input" do
displayed_text = "You entered " + edit_text
endItem