Application Object

 

The Application object represents the Grapher program. It is a single instance of Grapher and it is the root of all objects in Grapher. External programs typically create an instance of the Application object during initialization. In VB this is done using the CreateObject function as in:

 

Set GrapherApp = CreateObject("Grapher.Application")

 

The CreateObject function activates a new instance of Grapher, and returns a reference to the Application object to the script.

 

When Grapher is started by a script, its main window is initially hidden. To make the Grapher window visible, you must set the Application object’s Visible property to True:

 

Set GrapherApp = CreateObject("Grapher.Application")

GrapherApp.Visible = True

 

Other methods and properties of the Application object let you move and resize the Grapher window, adjust the main window state (maximized, minimized, hidden), change the window caption, and modify preference settings.

 

The Application object provides two important collections that allow access to the next level of objects in the hierarchy. Use the Documents property to obtain a reference to the Documents collection, and use the Windows property to obtain a reference to the AutoWindows collection. The Documents and AutoWindows collections provide access to the other objects in the object hierarchy. You can access the currently active window objects with the Application object’s ActiveWindow properties.

 

Properties

ActiveWindow

Application

DefaultFilePath

Documents

FullName

Height

Left

Name

Parent

Path

Top

Version

Visible

Width

Windows

WindowState

 

Methods

DisplayManager

DisplayToolbar

Quit

WindowArrangeIcons

WindowCascade

WindowTile

 

Example

The following script demonstrates how the Application object is used.

 

Sub Main

 'Declares GrapherApp as an object

  Dim GrapherApp As Object

 

 'Creates an instance of the Grapher application object

 'and assigns it to the variable named "GrapherApp"

  Set GrapherApp = CreateObject("Grapher.Application")

 

 'Make Grapher visible

  GrapherApp.Visible = True

End Sub