CGridView:Attach


The Attach method creates a new CGridView object attached to a grid window on the Mira desktop. The script can then collect data from the grid and change its contents. This method selects the top-most grid window of all windows on the desktop. This function does not use an existing CGridView object. Since this method creates a new object, you must using the class name CGridView. Also see the similar non-class function attach_gridview. Since a new CGridView object is created by this method, you must call it using the CGridView class name rather than an existing object (see the example below).

The related CGridView:AttachFromList method attaches the grid window selected from a list of all open grid windows.

Syntax

CGridView_obj = CGridView:Attach()

bullet.gif    On success, a new CGridView class object is returned.

bullet.gif    On failure, nil is returned. This usually means no grid window is shown on the Mira desktop.

Example

Assume that several grid windows are displayed on the Mira desktop, and the window of interest, such as a table of measurements, is top-most of all grid windows. The following script attaches that window to the script:

G = CGridView:Attach()

-- attach the top-most grid window

if G == nil then Exit() end

-- if not successful, exit the script

Printf("Attached grid %s\n")

-- print the title of the attached window

Related Topics

CGridView class

new

attach_gridview

AttachFromList


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.