Windows Collection

The Windows collection provides access to all windows within Surfer. The Windows collection returned by the Application object contains all the windows in the application, including the plot window, the worksheet window, and the grid editor views. To create new Window objects, call a Document object’s NewWindow method.

The Windows collection returned by the PlotDocument object contains all the windows opened on the parent plot document.

The Windows collection returned by the WksDocument object contains all the windows opened on the parent worksheet document.

The Windows collection returned by the GridWindow object contains all the windows opened on the parent grid document.

The following table provides all properties of Windows Collection:

Property

Description

Application

Returns the application object. Its a read-only property

Count

Returns the number of windows. Its a read-only property.

Parent

Returns the parent object. Its a read-only property.

The following table provides all methods of the Windows collection:

Method

Description

Arrange

Returns the application object. Its a read-only property

Item*

Returns the number of windows. Its a read-only property.

*default method

Example 1

This script displays all the methods and properties in the Windows collection.

Example 2

The following script demonstrates how the Windows collection is used in reference to the Application object.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it

'to the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Windows as an object

Dim Windows As Object

 

'Assigns the Windows Collection to the variable named "Windows"

Set Windows = SurferApp.Windows

 

End Sub

Example 3

The following script demonstrates how the Windows first document in the collection is used in reference to the PlotDocument object.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it

'to the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Plot as an object

Dim Plot As Object

 

'Creates a plot document in Surfer and assigns it to the variable

'named "Plot"

Set Plot = SurferApp.Documents.Add(srfDocPlot)

 

'Declares Windows as an object

Dim Windows As Object

 

'Assigns the Windows Collection to the variable named "Windows"

Set Windows = Plot.Windows(1)

 

End Sub

Example 4

The following script demonstrates how the Windows collection is used in reference to the WksDocument object.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it

'to the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Wks as an object

Dim Wks As Object

 

'Creates a worksheet document in Surfer and assigns it to the variable

'named "Wks

Set Wks =

 

'Declares Windows as an object

Dim Windows As Object

 

'Assigns the Windows Collection to the variable named "Windows"

Set Windows = Wks.Windows

 

End Sub

 

See Also

Window object