CGrid:Attach
The Attach method attaches an existing grid window and returns it as a new CGrid object. This method works only if the script is run on a grid window with that grid window 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.
Gtmp = G:Attach()
where
Gtmp is the CGrid object of the attached grid window. The return value Gtmp equals G if the grid was attached. If not, Gtmp is nil.
This method is a class-based version of the global AttachGrid function.
The following script attaches an existing grid window to work with it from the script:
|
-- Attach an existing grid window |
|
-- exit if nil because not a grid window |
|
-- Returns the number of grid columns |
|
-- Returns the number of grid rows |
|
- Result: Grid: 3x50 |