Altova StyleVision 2024 Enterprise Edition

Macros on Design Elements

Home Prev Top Next

Macros can be assigned to design elements via the Authentic Properties window. In the screenshot below the macro named OnResetAll has been selected from a list of available macros and assigned to a button’s OnClick event:

 

MacrosAssigning01

 

Different design elements support different user actions for which macros can be assigned. The table below gives a complete list.

 

User action

Supported design element

Can cancel event

OnClick

Button, Image

No

OnBeforeLinkClick

Link

Yes

OnBeforeChange

Content, Rest-of-Content, Input Field, Multiline Input Field, Checkbox, Radiobutton, Combobox

Yes

OnAfterChange

Content, Rest-of-Content, Input Field, Multiline Input Field, Checkbox, Radiobutton, Combobox

No

OnSetFocus

Content, Rest-of-Content, Input Field, Multiline Input Field, Checkbox, Radiobutton, Combobox

No

OnKillFocus

Content, Rest-of-Content, Input Field, Multiline Input Field, Checkbox, Radiobutton, Combobox

No

 

Macros assigned to these user actions will be called only on primary user input. They are not called on an undo action, or when the action was from outside Authentic View (for example, from a COM API call). If a macro is to be used to cancel further event processing, the user needs to place a COM API call AuthenticView.DoNotPerformStandardAction() in the macro where it is required. For example, it can be put in the macro BeforeChangeToEU (listing below) which has been assigned to a OnBeforeChange event for a radio button:

 

if ( !confirm( "Are you sure to change address data to EU?\All existing address data will be deleted!") )

       AuthenticView.DoNotPerformStandardAction();

 

This will prevent the changing of the radio button value if the user canceled the confirm dialog. This example is in the file OnChange.sps is in the Authentic\Scripting folder of the Examples project in the Project window. You can open this file and see how the macro works.

 

Useful features

After a macro has been assigned in the Properties window (screenshot below), it can be quickly accessed for editing in the Scripting Editor by clicking the Edit Macro button to the right of its name (see screenshot below).

 

MacrosAssigning02

 

© 2017-2023 Altova GmbH