AttachGrid


The AttachGrid function attaches an existing grid window and returns its CGrid object to the script. This method works only if the script is run on a grid window with that grid windowbeing the top-most window. This is how the script knows which window to attach. If the top-most window is not a grid window when the script attaches it, this function will return nil. To attach the default CGrid pane that opens from the Script Editor, use DefGrid instead. To create a new, empty grid window, use NewGrid.

Syntax

G = AttachGrid()

where

    G is the CGrid object of the existing grid window. On failure, nil is returned.

  

This global function is simply a convenience wrapper around the CGrid:Attach method.

Example

The following script attaches an open grid window (Mira report) to the script:

 

G = AttachGrid()

-- Attach an existing grid window

Assert(G,"Not a grid window")

-- exit with a message if not a grid window

c = G:GetCols()

-- Returns the number of columns in the grid

r = G:GetRows()

-- Returns the number of rows in the grid

Printf("Grid: %dx%d\n", c, r )

- Result: Grid: 3x50

 

 

Related Topics

Attach

new

CGrid class

DefGrid

NewGrid