CTextView:AttachHandle


The AttachHandle method attaches a window handle to this CTextView object. The handle may have been obtained from the System Registry using the CRegistry:GetWnd method.

Syntax

success = CTextView:AttachHandle( handle )

    handle is the handle of a text window displayed on the Mira desktop.

    On success, returns true; on failure it returns false.

  

The window handle applies only to a specific Text window displayed on the Mira desktop. If you close a text window and create a new text window, the new window will have a different handle value. Use this method to fetch the handle of an existing GUI text window that was saved by a previous script.

Example

The following script fetches the handle of an existing GUI text window from the registry, attaches the handle to a CTextView object, and then prints a new string in the window. It is assumed that the text window's handle was saved to the Registry by a prior script.

Reg = CRegistry:new("TextData")

-- create a link to the Registry

  --

-- get a string, s, to list

T = CTextView:new()

-- create a new CTextView for the string

handle = Reg:GetWnd( "TextWindow" )

-- fetch the handle of the existing GUI text window

T:AttachHandle( handle )

-- attach the handle to this CTextView object

T:Printf("New output: %s\n", s )

-- add the string to the existing text window

Related Topics

GetHandle

CTextView class

CRegistry:GetWnd