Connecting to TextMaker

<< Click to Display Table of Contents >>

Connecting to TextMaker

In order to control TextMaker from BasicMaker, you first need to connect to TextMaker via OLE Automation. For this, first declare a variable of type Object, then assign to it the object "TextMaker.Application" through use of the CreateObject function.

Dim tm as Object

Set tm = CreateObject("TextMaker.Application")

If TextMaker is already running, this function simply connects to TextMaker; if not, then TextMaker will be started beforehand.

The object variable "tm" now contains a reference to TextMaker.

Important: Making TextMaker visible

Please note: If you start TextMaker in the way just described, its application window will be invisible by default. In order to make it visible, you must set the property Visible to True.

The complete chain of commands should therefore be as follows:

Dim tm as Object

Set tm = CreateObject("TextMaker.Application")

tm.Application.Visible = True

The "Application" object

The fundamental object that TextMaker exposes for programming is Application. All other objects – such as collections of open documents and windows – are attached to the Application object.

The Application object contains not only its own properties (such as Application.Left for the x coordinate of the application window) and methods (such as Application.Quit for exiting from TextMaker), but also contains pointers to other objects, for example Application.Options, that in turn have their own properties and methods and pointers to collections such as Documents (the collection of all currently open documents).

Notations

As mentioned in the previous section, you need to use dot notation as usual with OLE Automation to access the provided properties, methods, etc.

For example, Application.Left lets you address the Left property of the Application object. Application.Documents.Add references the Add method of the Documents collection which in turn is a member of Application.