Authentic ScriptingAltova StyleVision® 2012 includes a complete integrated scripting environment that allows you to build advanced content entry and eForms applications based on the Authentic platform. Authentic scripting lets developers create robust data entry applications for Authentic users who can directly update XML and database sources using eForms designed entirely in StyleVision. Scripts are created in StyleVision and executed in Authentic, giving Authentic users the ability to work with interactive eForms directly within Authentic Desktop or Browser. The scripting functionality (event handlers, macros, and forms) is embedded directly into the StyleVision design (SPS) so that Authentic end-users only need to open the file to work with complex, detailed, and user friendly eForms. Event handler and macro components can be written using supported scripting languages, JavaScript or VBScript, and you can also design input forms graphically using drag and drop functionality. To embed scripting functionality in a StyleVision design (SPS), you can open the Scripting Editor window via the Authentic | Edit Authentic Scripts menu command or by choosing Authentic Script from the Design tab context menu.
The Scripting Editor provides an interface through which you can create any of the following four main components:
Global DeclarationsThe GlobalDeclarations component is presented by default in every scripting project. Variables and functions are added using code fragments written in the scripting language (JScript or VBScript) associated with your project. An example function, StartChangingAddress, appears below: function StartChangingAddress( sTo )
{
elemAddress =
AuthenticView.XMLDataRoot.
GetChildElement( "ScriptingSamples", 0 ).
GetChildElement( "Address", 0 );
// first, delete all existing children of the Address element
elemAddress.EraseAllChildren();
// append the new attribute value
attrUSorEU = AuthenticView.CreateXMLNode( spyXMLDataAttr );
attrUSorEU.Name = 'USorEU';
attrUSorEU.TextValue = sTo;
elemAddress.AppendChild( attrUSorEU );
// append the EU or US element which will contain address details
elemParent = AuthenticView.CreateXMLNode( spyXMLDataElement );
elemParent.Name = sTo;
elemAddress.AppendChild( elemParent );
return elemParent;
}
Variables or functions created in the global declarations script are accessible to all forms, event handlers, and macros in your scripting project. MacrosMacros let you create functions that are called from other scripts or event handlers. For example, the macro shown below uses the GlobalDeclarations, including the StartChangingAddress function, to create a form for adding information to an active XML document. elemParent = StartChangingAddress( 'EU' ); // and now append all address elements in EU elemChild = AuthenticView.CreateXMLNode( spyXMLDataElement ); elemChild.Name = 'Street'; elemParent.AppendChild( elemChild ); elemChild = AuthenticView.CreateXMLNode( spyXMLDataElement ); elemChild.Name = 'City'; elemParent.AppendChild( elemChild ); elemChild = AuthenticView.CreateXMLNode( spyXMLDataElement ); elemChild.Name = 'Country'; elemParent.AppendChild( elemChild ); Macros can be specified and associated with StyleVision design elements using the Authentic group in the Properties window. Object events that are supported for macros are:
Macros are controlled in the right-click menu of the scripting project tree, where you can add or rename.
Event HandlersEvent handlers can also be defined by selecting the Events icon in the toolbar of the Properties and Events pane. Here, you can define the behavior that the application should exhibit once a specific action is initiated or completed. Events that can be controlled include mouse movement and clicks, drag and drop, key presses, and more. Authentic View event scripts in StyleVision® 2012 include:
The scripting editor provides a folder which contains the full set of events for which event handler scripts can be written.
FormsThe Authentic Scripting Editor lets you graphically build forms using a palette of objects such as text input fields, buttons, labels, and more. General form properties such as size, background color, font styles, etc. are defined in the Properties pane.
The form object palette provides all of the objects that are available. Registered ActiveX controls can also be added by selecting the Add ActiveX Control command in the right-click menu.
Once an object has been inserted in your design, you can specify its appearance properties - such as alignment, borders, scroll bars, etc. - in the Properties pane. Scripting in PracticeAuthentic View scripting gives StyleVision designers complete and flexible control over various aspects of the user interface. In addition, a revamped Java API and extensions to the existing COM APIs add more flexibility for scripting and interactive eForm design. For example:
Altova provides various examples of StyleVision scripts in practice in the examples that ship with the product.
Test drive the powerful Authentic View Scripting Editor to add an interactive element to your data entry applications. Download a free 30-day trial of StyleVision. |
| |||||||||||||||||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
