Altova StyleVision 2024 Professional Edition

Macros are single programs that are executed when a user action occurs. Macros do not take a parameter, do not return a value, and do not call other macros directly. However, code that needs to be reused by multiple macros or event handlers can be put in a function in the Global Declarations area.

 

A macro that is not assigned to a specific user action will not be executed. Valid user actions may be an interaction with a specific design element, a toolbar button click, or the selection of a user-defined context menu item.

 

The EventContext property

An SPS design element can appear in multiple places. To determine in which context a macro is executed, the AuthenticView interface has a property called EventContext to hold the context. Via the EventContext property, a macro can query the XPath location where the macro was started, evaluate XPath expressions in the current node, and access variables defined in the scope of the location. For more details, see the section AuthenticView API.

 

Checking macro references

The designer might accidentally rename a macro or delete it from the script project, though it is still referenced in the design. To help prevent or correct such errors, the command Authentic | Check Macro References checks for invalid references. A dialog will pop up to help the user replace or delete the reference.

 

In this section

In this section we look at how macros can be associated with valid user actions:

 

Macros on Design Elements

Macros on Toolbar Buttons

Macros on Context Menu Items

 

© 2018-2024 Altova GmbH