CGridView:AttachFromList


The AttachFromList method connects a grid window to the script after it is selected from a list of all grid windows. The selected grid window is returned as a new CGridView object. This method opens a window like the one shown below. Each item consists of the grid window title and the number of grids in the window's grid set. In comparison, the Attach method selects the top-most (grid) window for processing.

 

Syntax

NewGridView_Object = CGridView:AttachFromList()

where

    NewGridView_Object is a new CGridView attached from the selected grid window.

    On success, this method returns a new CGridView object. On failure, nil is returned.

  

This method is used to attach a CGridView chosen from a list. When this method is called, the script creates a window similar to a GetItem dialog with the drop box populated with the titles of the open grid windows. To attach one of the grid windows to the script, select an item and click [OK]. This action creates a new CGridView, attaches it to the selected window, and returns the CGridView to the script.

Note: This method creates the CGridView, so the new constructor should not be called to create this same object before calling the AttachFromList method.

Example

This script selects an open grid window from a list and then copies its currently displayed grid into a new grid window. If the new window contains a grid set, the grid is appended to the end of the set:

V = CGridView:AttachFromList()

-- create a list of open grid windows

Assert(V,"No grid window selected")

-- exit the script if valid window not selected

G = V:GetGrid()

-- get the current grid from the selected window

Vnew = CGridView:new()

-- create a new CGridView

Vnew:Append( G )

-- display the grid in a new window

Related Topics

Attach

new

CGridView class