Window (object)

<< Click to Display Table of Contents >>

Window (object)

Access paths:

Application à Windows à Item

Application à ActiveWindow

Application à Documents à Item à ActiveWindow

Application à ActiveDocument à ActiveWindow

 1  Description

A Window object represents one individual document window that is currently open in TextMaker.

An individual Window object exists for each document window. If you open or close document windows, the respective Window objects will be created or deleted dynamically.

 2  Access to the object

The individual Window objects can be accessed in any of the following ways:

All open document windows are managed in the Application.Windows collection (type: Windows):

' Show the names of all open document windows

For i = 1 To tm.Application.Windows.Count

 MsgBox tm.Application.Windows.Item(i).Name

Next i

You can access the currently active document window through Application.ActiveWindow:

' Show the name of the active document window

MsgBox tm.Application.ActiveWindow.Name

Window is the Parent of the View object:

' Show the name of the current document in an indirect way

MsgBox tm.Application.ActiveWindow.View.Parent.Name

The object Document contains an object pointer to the respective document window:

' Access the active document window through the active document

MsgBox tm.Application.ActiveDocument.ActiveWindow.Name

 3  Properties, objects, collections and methods

Properties:

FullName R/O

Name R/O

Path R/O

Left

Top

Width

Height

WindowState

DisplayHorizontalRuler

DisplayVerticalRuler

DisplayRulers

DisplayHorizontalScrollBar

DisplayVerticalScrollBar

 

Objects:

Document Document

View View

Application Application

Parent Windows

 

Methods:

Activate

Close

FullName (property, R/O)

Data type: String

Returns the path and file name of the document opened in the window (e.g., "c:\Letters\Smith.tmdx").

Name (property, R/O)

Data type: String

Returns the file name of the document opened in the window (e.g., "Smith.tmdx").

Path (property, R/O)

Data type: String

Returns the path of the document opened in the window (e.g., c:\Letters).

Left (property)

Data type: Long

Gets or sets the horizontal position of the window, measured in screen pixels.

Top (property)

Data type: Long

Gets or sets the vertical position of the window, measured in screen pixels.

Width (property)

Data type: Long

Gets or sets the width of the document window, measured in screen pixels.

Height (property)

Data type: Long

Gets or sets the height of the document window, measured in screen pixels.

WindowState (property)

Data type: Long (SmoWindowState)

Gets or sets the state of the document window. The possible values are:

smoWindowStateNormal   = 1 ' normal

smoWindowStateMinimize = 2 ' minimized

smoWindowStateMaximize = 3 ' maximized

DisplayHorizontalRuler (property)

Data type: Boolean

Gets or sets the setting whether a horizontal ruler should be shown in the document window (True or False).

DisplayVerticalRuler (property)

Data type: Boolean

Gets or sets the setting whether a vertical ruler should be shown in the document window (True or False).

DisplayRulers (property)

Data type: Boolean

Gets or sets the setting whether both horizontal and vertical rulers should be shown in the document window (True or False).

DisplayHorizontalScrollBar (property)

Data type: Boolean

Gets or sets the setting whether a horizontal scroll bar should be shown in the document window (True or False).

DisplayVerticalScrollBar (property)

Data type: Boolean

Gets or sets the setting whether a vertical scroll bar should be shown in the document window (True or False).

Document (pointer to object)

Data type: Object

Returns the document object assigned to this document window. With this you can read and set numerous settings of your document.

View (pointer to object)

Data type: Object

Returns the view object from the document window. You can use this to read and set various settings for the screen display.

Application (pointer to object)

Data type: Object

Returns the Application object.

Parent (pointer to object)

Data type: Object

Returns the parent object, i.e. an object of the type Windows.

Activate (method)

Brings the document window to the foreground (if the property Visible for this document is True) and sets the focus to it.

Syntax:

 Activate

Parameters:

none

Return type:

none

Example:

' Activate the first document window

tm.Windows(1).Activate

Close (method)

Closes the document window.

Syntax:

 Close [SaveChanges]

Parameters:

SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the document opened in the window should be saved or not (if it was changed since last save). If you omit this parameter, the user will be asked to indicate it (if necessary). The possible values for SaveChanges are:

 smoDoNotSaveChanges = 0      ' Don't ask, don't save

 smoPromptToSaveChanges = 1   ' Ask the user

 smoSaveChanges = 2           ' Save without asking

Return type:

none

Example:

' Close the active window without saving it

tm.ActiveWindow.Close smoDoNotSaveChanges