xml spy
Top  Next
The XMLSpyFormEditor

XMLSpyFormEditor is the scripting environment of XMLSpy. It gives you the ability to create, manage and store your own forms, macros and event handlers.  
 
Before you can start using the scripting environment, you must download it from the Component Download Center on our web site http://www.xmlspy.com. Afterwards you can start the installation.  
 
To invoke the scripting environment select "Tools | Switch to scripting environment". There is a predefined global scripting project active the first time you start the form editor. This project is installed with the scripting component of XMLSpy and contains a sample that interacts with the Altova.xml file.  

The screen shot below shows the "FormDate" form and the implementation of the On_BeforeStartEditing event handler. Both are part of the provided Altova sample.

scripting_formeditorall

The graphic also shows the main parts of the XMLSpyFormEditor. The "Project window" (left), the "Property Sheet" (left), the client area with any open forms or modules (in the middle) and the "Tool Bar" on the right.

To test the sample, switch back to XMLSpy and open the file Altova.xml. Activate the Enhanced Grid View and try to start editing the "/a:Altova/Division/Established" (XPath) element.

Project Window
The Project window gives you access to the forms and modules of a all open scripting projects.
There is always one active scripting project. The title of the active project is printed in bold. Several commands of the File and Project menus refer to the currently active project only.

   scripting_projectbar

Two context-sensitive popup menus are available within the Project Bar. The first appears if you right-click the title of a project, and the second if you click a form or module. These popup menus gives you access to functions also available in the "File" and "Project" menus in the menu bar.

The Property Sheet

The Property Sheet lists all properties and events of the selected user interface element (buttons, list-boxes, ActiveX controls, etc.) of the active form.

It gives you the ability to modify these properties and to add code to the empty event handlers. The combo-box at the top lists all controls of the form.

The pictures below shows the three pages of the Microsoft DatePicker ActiveX control. Please note that different controls have different properties, and not all controls have three tabs in the Property Sheet.

scripting_propsheet

The name of a control is specified by the (ObjectCode) property (here MScomCtl21). If you write some scripting code and need access to methods or properties of the control, you must use this name. Example:

   var strTmp;
   strTmp = "";
   strTmp = MSComCtl21.Year + '-' + MSComCtl21.Month + '-' + MSComCtl21.Day;


The "How to create a form" page gives you an example on adding some code to the click-event of a control.

The Tool Bar
Use the Tool Bar to add controls to your forms. Select a control from the bar and draw a rectangle in your form, to set its place and size.

   scripting_toolbar

The most common controls from the Tool Bar are:

scripting_statictextStatic Text   - Adds text fields like captions or field descriptions.  

scripting_buttoniconButton   - Adds a button to your form. It is possible to assign bitmaps to these buttons.  

scripting_checkboxCheckBox   - Enables Yes-No style elements  

scripting_comboboxComboBox   - Gives the user the ability to enter text or to select an entry from the drop-down list.  

scripting_listboxListBox   - Displays a list of items for selection.  

scripting_editiconEditBox   - Defines a single line of text.  

scripting_multieditMultiEditBox   - Defines multiple lines of text.  

scripting_activexActiveX      - Allows the integration of an ActiveX control in the form.  

All of these controls have their own properties and events. Select a control in your form and use the Property Sheet to modify the properties and add some scripting code to the provided events.

Top  Next

© 2002 Altova