CTextView:Class Description CTextView:delete

CTextView:new


The new method creates an instance of the CTextView class. A new Mira Text Editor window is opened with the specified title, unless a Text Editor already exists with the same name.

Syntax

T = CTextView:new( sTitle=nil, CRect=nil )

Remarks

The CTextView constructor attaches itself to a Mira Text Editor window based on the specified name. If a Text Editor window of the same name already exists, this constructor attaches to that window. Otherwise, a new window 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.

This method returns to the caller a reference to the object it creates. The calling code must assign this reference to a name (see below), as in T = CTextView:new("My Window Title"). If the object cannot be created, nil is returned for T.

This method's name uses all lower case to present it as the analog of the C++ new operator. Generally, the names of class methods begin with an uppercase letter but new and delete are different.

Example

The following script fragment creates a new CTextView and opens a Mira Text Editor window with the specified title:

T = CTextView:new("Title")

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

  ...

-- other uses of the class go here

T:delete()

-- deletes the object.

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

T = CTextView:new(sTitle, R)

-- create a new instance T with title and size

R:delete()

-- no longer need the CRect

  ...

-- other uses of the class go here

T:delete()

-- deletes the object.

Related Topics

CTextView, delete