CreateTextWindow


The CreateTextWindow function opens a new Mira Text Editor window. The title and size can be specified.

Syntax

CTextView = CreateTextWindow()

CTextView = CreateTextWindow( sTitle )

CTextView = CreateTextWindow( sTitle, CRect )

where

    sTitle is a string that specifies the window caption. if not passed, a default caption is used.

    CRect is a rectangle specifying the fractional dimensions of the window in terms of the Mira viewport. All CRect members must be between 0 and 1. If CRect is not passed or is nil, then a default window size is used.

    CTextView is a reference to a new Text Editor window. On failure, nil is returned.

  

This is a global version of the CTextView class new method. After creating the text window using this function, you can use the global Wprintf function to write to the window. If a Text Editor window already exists with the specified name, this function returns a reference to the existing window. Otherwise, a new Text Editor is created.

Note that the CRect argument specifies a window size in terms of the current Mira viewport (the main window size). For example, if CRect contains the dimensions (0.1, 0.7, 0.1, 0.7), then a window will be created that extends from 10% to 70% of the viewport size.

Example

The following script opens a Mira Text Editor window with the specified title:

ptr = CreateTextWindow("My Title")

-- create a new instance T of the CTextView class.

Wprintf(ptr, fmt, "my text...")

-- write to the window by passing its pointer, ptr

The next example creates a new CTextView with a specified title and size

sTitle = "My Window Title"

-- window title

R = NewRect(0.1,0.7,0.1,0.7)

-- window rectangle relative to main window

ptr = CreateTextWindow(sTitle, R)

-- create a new window with title and size

Wprintf(ptr, fmt, "my text...")

-- write to the window by passing its pointer, ptr

Related Topics

Wprintf

CTextView class