CreateTextWindow
The CreateTextWindow function opens a new Mira Text Editor window. The title and size can be specified.
pointer = CreateTextWindow( sTitle=nil, CRect=nil )
sTitle is a string that specifies the window caption. if nil, a default 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 specified or is nil, then a default window size is used.
On success, this method returns a pointer to the Mira Text 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.
The following script fragment 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 = CRect:new(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 |