Component Scripting Reference

This section provides a reference for the interfaces, property pages, properties, methods, and events supplied by the component edition of Zed as part of the Zed Custom API.


Interfaces
Property Pages
Properties
Methods
Events

The component edition of Zed provides a basic collection of interfaces, property pages, properties, methods, and events that can be used by application developers to control many aspects of the behavior of the editor. The interfaces described in the following sections can be used from any scripting language that supports ActiveX scripting, including JavaScript and VBScript.


Interfaces

The interfaces provided by Zed allow the component edition to be used from scripting languages that support ActiveX scripting. ActiveX interfaces are identified by universally unique identifiers (UUIDs) and by help strings that are associated with each interface. The property pages described in the next subsection are also identified by UUIDs, as are the document types supported by the application edition. The following table lists the UUIDs and help strings for the different flavors of Zed interfaces.

Name UUID Help String
Zed Component Class ID {8D917303-E449-465A-B882-90EFB15B8492} Integre MathML Equation Editor Component
Zed Component Type Library {FC452EF6-0C2A-4EB7-8385-A8ED3C4C6725} Integre MathML Equation Editor Component
Zed Component Dispatch Interface {B45A10EF-F044-40D4-BF7F-8587243D3563} Dispatch interface for the Integre MathML Equation Editor Component
Zed Component Event Dispatch Interface {6F2C7BB8-9214-4C37-AA09-E37698DE2A4C} Event interface for the Integre MathML Equation Editor Component
Zed Source Property Page {34DE0B73-C011-4704-BF35-545566B57B0B}
Zed Config Property Page {AFB54F29-9CC9-4321-AEF6-B0EFAA2FF72C}
Zed Other Property Page {B6378F5A-749F-4922-95A8-2EC21BBCF35F}
Zed Document {0E64B9D6-B3D0-4F96-B877-CAD39D32CCD3}
Zed MathML Document {ED9DCBDA-1CAA-41C3-909A-EF5AE963D03D}

Property Pages

Source
Config
Other

The property pages that Zed supports can be used inside certain ActiveX containers to set initial values for the properties provided by the component. These property pages are similar in many respects to the corresponding configuration dialogs available from the context menus provided in the user interface.


Source

The Source property page allows you to set the initial contents of the component, using either the external MathML expression encoding or the internal Zed expression encoding, by setting one of the four Zed properties described in the following section. The drop-down list selects the property to be used, and the Get and Set buttons work as they do on the configuration dialogs.


Config

The Config property page allows you to set the initial configuration customization of the component, by setting any of the six configuration properties described in the following section. The drop-down list selects the property to be used, and the Get and Set buttons work as they do on the configuration dialogs.


Other

The Other property page allows you to provide initial settings for two of the boolean properties described in the following section. Click the check boxes to set or clear the value of the AutoSize or GrabFocus properties to the desired value.


Properties

AutoSize
GrabFocus
FontSize
ReadyState
MmlSource
MmlContent
MmlPresent
MmlCurrent
ZedSource
ZedContent
ZedPresent
ZedCurrent
ZedPosition
ZedPositionById
MmlContentById
MmlPresentById
ZedContentById
ZedPresentById

The properties provided by Zed allow script writers to control aspects of how Zed is initialized (AutoSize, GrabFocus, and ReadyState), to get and set the MathML content or presentation, to get and set the Zed content or presentation internal form, and to get and set expressions specified by using a named identifier.


Boolean AutoSize

Set the AutoSize property to true to instruct Zed to automatically increase or decrease its size based on the size of the expression being edited. The default value of the AutoSize property is false.


Boolean GrabFocus

Set the GrabFocus property to true to instruct Zed to automatically grab the input focus once it completes loading. Typically there will only be one such instance of Zed on a given HTML page; if more than one instance of Zed has the GrabFocus property set, then only one of them will become the focus window. The default value of the GrabFocus property is false.


String FontSize

The FontSize property can be used to control the size of the font used to display the MathML source file associated with this instance of Zed. Setting the value of this property changes the value of the fontsize attribute in the presentation of the MathML content contained in the document.


Integer ReadyState

The ReadyState stock property provides a standard indication of the current progress of loading the Zed component. Zed uses only the standard loading and complete state values.


String MmlSource

The MmlSource property can be used to extract the name of the MathML source file associated with this instance of Zed. Setting the value of this property loads the expression being edited from the named file, which should contain data in MathML format.


String MmlContent

The MmlContent property can be used to extract the MathML content string for the entire expression being edited by this instance of Zed. Setting the value of this property changes the expression being edited to the value given.


String MmlPresent

The MmlPresent property can be used to extract the MathML presentation string for the entire expression being edited by this instance of Zed. Setting the value of this property changes the expression being edited to the value given.


String MmlCurrent

The MmlCurrent property can be used to extract the MathML content string for the current expression being edited by this instance of Zed. Setting the value of this property changes the current expression being edited to the value given.


String ZedSource

The ZedSource property can be used to extract the name of the Zed source file associated with this instance of Zed. Setting the value of this property loads the expression being edited from the named file, which should contain data in Zed format.


String ZedContent

The ZedContent property can be used to extract the Zed internal content string for the entire expression being edited by this instance of Zed. Setting the value of this property changes the expression being edited to the value given.


String ZedPresent

The ZedPresent property can be used to extract the Zed internal presentation string for the entire expression being edited by this instance of Zed. Setting the value of this property changes the expression being edited to the value given.


String ZedCurrent

The ZedCurrent property can be used to extract the Zed internal content string for the current expression being edited by this instance of Zed. Setting the value of this property changes the current expression being edited to the value given.


String ZedPosition

The ZedPosition property can be used to extract a list of indexes that describe the location of the current expression within the content expression being edited by this instance of Zed. Setting the value of this property changes the location of the expression cursor to point to the location given.


String ZedPositionById

The ZedPositionById property can be used to extract an identifier that appears as the id attribute of the current expression. Setting the value of this property changes the location of the expression cursor to point to the expression in the document whose id attribute has the given value.


String MmlContentById ( String id )

The MmlContentById parameterized property can be used to extract the MathML content string for the named expression. The expression returned is selected by looking for an id attribute whose value matches the parameter given. Setting the value of this property changes the named expression to the value given.


String MmlPresentById ( String id )

The MmlPresentById parameterized property can be used to extract the MathML presentation string for the named expression. The expression returned is selected by looking for an id attribute whose value matches the parameter given. Setting the value of this property changes the named expression to the value given.


String ZedContentById ( String id )

The ZedContentById parameterized property can be used to extract the Zed internal content string for the named expression. The expression returned is selected by looking for an id attribute whose value matches the parameter given. Setting the value of this property changes the named expression to the value given.


String ZedPresentById ( String id )

The ZedPresentById parameterized property can be used to extract the Zed internal presentation string for the named expression. The expression returned is selected by looking for an id attribute whose value matches the parameter given. Setting the value of this property changes the named expression to the value given.


Methods

LoadConfig
SaveConfig
GetConfig
SetConfig
AddConfig
ReadConfig
WriteConfig
ShowPalette
HidePalette
ShowFormat
ApplyTemplate
ApplyTemplateByName

The methods provided by Zed allow script writers to customize the configuration options that control how the user interacts with mathematical operators, to create and use configuration files encapsulating these options, and to control the state of the template palettes.


Boolean LoadConfig ( String name )

The LoadConfig method allows a script writer to load a customized configuration file, specified by name. If no file type is specified in the file name, it is assumed to be .zc. If no path is specified in the file name, the configuration file is assumed to be in the Config directory where Zed is installed. The LoadConfig method returns true on success, false on failure.


Boolean SaveConfig ( String name )

The SaveConfig method allows a script writer to save a custom configuration file, specified by name, containing the current state of all configuration options. If no file type is specified in the file name, it is assumed to be .zc. If no path is specified in the file name, the configuration file will be written into the Config directory where Zed is installed. The SaveConfig method returns true on success, false on failure.


String GetConfig ( String key )

The GetConfig method allows a script writer to retrieve a configuration property as a string, one section at a time, by giving the name of the desired configuration property. The information returned by the method is in the same format as is shown by the corresponding configuration dialog.


Boolean SetConfig ( String key, String value )

The SetConfig method allows a script writer to set a configuration property from a string, one section at a time, by giving the name of the configuration property to be changed. The information given as the second parameter to the method should be in the same format as is shown by the corresponding configuration dialog. The SetConfig method returns true on success, false on failure.


Boolean AddConfig ( String key, String value )

The AddConfig method allows a script writer to add to a configuration property from a string, one section at a time, by giving the name of the configuration property to be augmented. The information given as the second parameter to the method should be in the same format as is shown by the corresponding configuration dialog, and should include only those additional declarations to be added to the configuration property. The AddConfig method returns true on success, false on failure.


Boolean ReadConfig ( String key, String name )

The ReadConfig method allows a script writer to read a configuration property from a file, one section at a time, by giving the name of the configuration property to be augmented, and the name of the file containing the information to be read. The information in the file named by the second parameter to the method should be in the same format as is shown by the corresponding configuration dialog. The ReadConfig method returns true on success, false on failure.


Boolean WriteConfig ( String key, String name )

The WriteConfig method allows a script writer to write a configuration property to a file, one section at a time, by giving the name of the configuration property to be augmented, and the name of the file to contain the information to be written. The information in the file named by the second parameter to the method will appear in the same format as is shown by the corresponding configuration dialog. The WriteConfig method returns true on success, false on failure.


Boolean ShowPalette ( String name )

The ShowPalette method allows a script writer to activate a particular named palette. The named palette will be displayed to the user, who can then select items from the palette just as if it had been activated by other means. The ShowPalette method returns true on success, false on failure.


Boolean HidePalette ( String name )

The HidePalette method allows a script writer to deactivate a particular named palette. The named palette will be removed from the desktop, but can be reactivated as desired. The HidePalette method returns true on success, false on failure.


Boolean ShowFormat ( String key, String value )

The ShowFormat method allows a script writer to control the layout formatting switches that appear on the formatting toolbar, by giving the name of the formatting switch as the key, and by giving the value of "true" or "false" to indicate whether to set or clear the corresponding layout formatting switch. The valid formatting switch names are "identity", "inverse", "assoc", "times", and "apply". These values correspond to the toggle buttons that appear on the formatting toolbar in the application edition. The ShowFormat method returns true on success, false on failure.


Boolean ApplyTemplate ( String template )

The ApplyTemplate method allows a script writer to invoke a template by specifying the template as the argument to the method. The format of the template supplied as the argument is the same as that used in the configuration dialog for creating named template rules. The ApplyTemplate method always returns true.


Boolean ApplyTemplateByName ( String name )

The ApplyTemplateByName method allows a script writer to invoke a named template by specifying the name of the template as the argument to the method. The format of the name of the template supplied as the argument is the same as that used in the configuration dialog for creating menus and palettes using named template rules. The ApplyTemplateByName method always returns true.


Events

ReadyStateChange
Onload
Update
Submit

The events provided by Zed allow script writers to synchronize actions with the completion of loading the Zed component (ReadyStateChange and Onload), with any modification to the expression in the Zed document (Update), or with a user-initiated action to submit the expression for further computation (Submit).


void ReadyStateChange ()

The ReadyStateChange stock event is fired any time the value of the ReadyState stock property changes. This event performs much the same role as the custom Onload event.


void Onload ()

The Onload event is fired once Zed has been completely loaded and all of its data structures have been initialized. The intent of this event is to allow script writers a means of ensuring that Zed is ready to accept other method calls before initiating other actions.


void Update ()

The Update event is fired each time that the expression contained in a Zed document is changed. As such, this event can signal any of a number of different conditions, including user input, script actions, and file or configuration property loading, among other things.


void Submit ()

The Submit event is fired upon request by the user, typically in response to a keyboard accelerator as specified by the configuration options. This event is typically bound to a key such as the Enter key, but may be rebound as desired by the script writer.