![]() |
Previous Top Next |
Main scripting features
|
1. | Because macros don't have parameters or return values, a function header should not exist in the macro implementation.
|
|
2. | Event handlers need function headers with the correct spelling of the event name, or the event handler won't get called.
|
|
3. | It is possible to declare local variables and helper functions within macros and event handlers.
|
Example:
|
|
//return value: true allows editing
|
// false forbids editing
|
|
var txtLocal;
|
|
function Helper()
|
{
|
txtMessage = txtLocal;
|
Application.ShowForm("MsgBox");
|
}
|
|
function On_BeforeStartEditing(objXMLData)
|
{
|
txtLocal = "On_BeforeStartEditing()";
|
Helper();
|
}
|
|
4. | Recursive functions are supported. The function DeleteXMLElements() from "How to create a Form" calls itself recursively.
|
|
5. | A form can display another form with the function Application.ShowForm().
|
|
6. | Out-parameters from methods of the XMLSpy API require special variables in JavaScript.
|
Example:
|
|
// use JavaScript method to access out-parameters
|
var strError = new Array(1);
|
var nErrorPos = new Array(1);
|
var objBadData = new Array(1);
|
|
bOK = objDoc.IsValid(strError,nErrorPos,objBadData);
|
|
7. | While a macro is executed, event handlers from XMLSpy are not processed.
|
|