CGrid Class Description
The CGrid class provides an alternative to the CGridView class for creating a grid control. Whereas a CGridView attaches to or creates a grid view window, the CGrid class opens a dialog window which may be of either the modeless or modal variety. These dialogs follow the standard Windows rules for modeless and modal dialogs. A modal dialog blocks interaction with windows other than itself whereas a modeless dialog permits interaction with other windows. A modeless dialog is created using new_griddlgmodal and a modal dialog is created using new_griddlg.
As with CGridView derived grid windows, a modeless CGrid derived dialog can execute other scripts while it is open. The script executed from the window or dialog is automatically given a CGridView class object for working with the data in parent grid. See the description below, under "Executing Scripts from a Grid Dialog."
The primary differences between the CGrid and CGridView classes are as follows:
The CGrid does not support all features of the CGridView class, including multiple grid sheets.
Whereas the CGridView class can either create a grid window or attach to an existing grid window, the CGrid class can only create a dialog window and cannot attach to an existing grid.
A modal grid dialog created from a CGrid object stops the script that opened it and blocks interaction with other windows while it remains open. The script that opened the modal dialog resumes when the dialog closes.
A modeless grid dialog created from a CGrid object continues the script immediately after opening and permits interaction with other Mira windows while open. The modeless dialog ends when you manually close it.
The figure below shows a modeless grid dialog created using new_griddlg, and with various embellishments and script commands added to the pop-up command menu. The script commands appearing in the bottom group were added using the class AddMenu command. The modal version of this dialog would be created using new_griddlgmodal. The pop-up menu for the modal version does not support script commands. This dialog was created by the sample script GridDlg (modeless) test with menu.lua.
The dialog's Execute Script menu command may be used to open and execute a script directly from a modeless CGrid dialog. When a script is executed from this command, it is automatically sent a CGridView object named ParentGrid that provides access to the window's grid control. You can use this name directly in the script or you can rename it, like G = ParentGrid. A sample script to call from a Grid Window is provided named Execute from Grid Dialog test.lua.
Construction |
Object = CGrid:new() Object = new_grid() |
Destruction |
Object:delete() |
This function is normally used to create and attach a new CGrid object as an alternative to the class-based new method. The new_griddlg and new_griddlgmodal methods are the only way to open the CGrid in a new grid dialog.
Creates a new instance of the CGrid class. The grid defaults may also be set using the GridParams table. This is an alternative to the CGrid:new method. |
|
Opens the CGrid object in a modeless dialog. |
|
Opens the CGrid object in a modal dialog |
Creates a new instance of a CGridView object. The grid defaults may also be set using the GridParams table. |
|
Deletes the instance of the CGrid object. |
|
The GridParams table may be used to initialize the properties of the new CGrid object when created. |
Adds a script command to the pop-up menu of the modeless grid dialog. |
|
Adds an "Execute Script" command to the pop-up menu of the modeless grid dialog. |
|
Adjusts the grid within the window for best fit over a range of columns. |
|
Deletes all script commands from the grid dialog's menu. |
|
Finds the top heading column containing the specified string. This is often used to find a grid column using its top heading title. |
|
Finds the side heading row containing the specified string. This is often used to find a grid row using its side heading title. |
|
Finds the grid cell column and row containing the specified string. |
|
Returns the number of columns in the grid. |
|
Returns the number of rows in the grid. |
|
Returns the value of a grid cell. |
|
Sends the grid cursor to the specified cell. |
|
Joins a block of cells into a single cell. |
|
Optimizes the width of all columns. |
|
Optimizes the widths over a column range. |
|
Sets the background color of a cell. |
|
Sets the fot color color of a cell. |
|
Sets the text alignment for a grid column. |
|
Sets the width of a grid column. |
|
Sets the vertical text alignment for a grid row. |
|
Sets the vertical stretch factor for a grid row. |
|
Sets the horizontal text alignment of a side heading column. |
|
Sets the title of a side header cell. |
|
Sets all titles for a side header column. |
|
Sets the vertical stretch factor for a grid heading rows. |
|
Sets the title of a top header cell. |
|
Sets all titles for a top header row. |
|
Sets the vertical text alignmentfor top heading rows. |
|
Sets the width of the side header in screen pixels. |
|
Sets the text color of a cell. |
|
Sets the grid cell value. |
|
Set the horizontal alignment of specific cells or an entire column. The default alignment is "left". |
|
Set the vertical alignment of specific cells or an entire row. The default alignment is "center". |
Script Classes, CGridView class, new_griddlg, new_griddlgmodal, Contents
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.