CGridCtrl Class Description
The CGridCtrl class provides access to the grid control used by Report windows and panes on the Mira desktop and grid windows created from a script using new_gridview and new_griddlgmodal . Mira uses grid controls to display a 2-dimensional grid of measurements and other values.
The CGridView class can create a grid window from the script or attach a grid window already on the Mira desktop. A script can be used to work with the cell data for example, to do further processing like computing statistics using the CStats class, performing least squares fitting using the CLsqFit class, and so forth. If your script creates a grid, the Grid Window has full access to the Mira GUI functions such as Mira pull-down and pop-up menus, or it can execute a new script as described below.
This class is similar to the CGrid class but offers more functionality. The primary differences between the CGridView and CGrid 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.
Note that scripts executed from a CGrid dialog, Mira Grid View window, or Grid Pane are all provided a CGridView object for manipulating the grid window that launched the script.
A grid control is a table consisting of cells arranged in a rectangular grid defined by the number of columns wide and the number of rows tall. Just as a Mira image window holds an image set consisting of multiple images, the Mira grid window holds a set of grids called "sheets". By default, a CGridCtrl is created with 1 sheet, but you may create it with additional sheets using the GridParams table or add sheets later by using AddSheet . You may switch between sheets using the tab below the grid window or using SelectSheet in a script. NOTE: All grid commands work with the top-most sheet in the grid window.
Below is a simple grid view window created by the CGridView class. Use the present CGridCtrl class to work with its grid control.
The Execute Script menu command may be used to open and execute a script directly from a Mira Grid Window. 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, likeG = ParentGrid. A sample script to be called from a Grid Window is provided, namedExecute from Grid Window test.lua.
A script can also be executed from a Grid Pane (e.g., containing measurements) attached to an Image Window. In this case, the Execute Script command is available only using the pane's pop-up menu opened using a right mouse click. A sample script to be called from a Grid Pane is provided, named Execute from Grid Pane test.lua.
Construction |
Object = new_gridctrl() Object = attach_gridctrl() Object = attachlist_gridctrl() Object = CGridCtrl:new() Object = CGridCtrl:Attach() Object = CGridCtrl:AttachFromList() |
Destruction |
Object:delete() |
These functions are normally used to create and attach a new CGridView object as an alternative to the class-based construction methods.
Creates a new instance of the CGridCtrl class from the grid control in a CGridView window or CGrid dialog. |
|
Directly attaches a grid control from a Grid Window on the Mira desktop using the grid window's title. The target window is not selected from a list of grid windows as with attachlist_gridctrl. It creates and returns a new CGridCtrl object. |
|
Attaches a CGridCtrl from a grid pane owned by a view window. |
Adds a sheet to the CGridCtrl object. |
|
Adjusts the grid within the window for best fit over a range of columns. |
|
Finds the column containing the specified string. This is often used to find a grid column using its top heading title. You may also search for the string within a specific row. |
|
Finds the row containing the specified string. This is often used to find a grid row using its side heading title. You may also search for the string within a specific column. |
|
Sets grid cells to the contents of a 2-dimensional table. |
|
Returns the grid column and row where the mouse button was last pressed to mark a cell or begin a selection. |
|
Returns thegrid column and row where the mouse button was last released to mark the last cell of a selection. |
|
Returns the grid column and row where the mouse button was last double-clicked. |
|
Returns a 1-dimensional table containing the contents of a grid column. |
|
Returns the numeric value in a grid cell. |
|
Returns the index of the maximum grid column containing data. |
|
Returns the index of the maximum grid row containing data. |
|
Returns the number of columns in the grid. |
|
Returns the number of rows in the grid. |
|
Returns the number of sheets in the grid. |
|
Returns a 2-dimensional table containing the contents of a grid rectangle. |
|
Returns a 1-dimensional table containing the contents of a grid row. |
|
Returns the index of the currently selected sheet. |
|
Returns the string value in a grid cell. |
|
Returns the data type for a grid cell. |
|
Returns the data and pixel type of a grid cell. |
|
Returns the title of the window or docking pane containing the grid control. |
|
Sends the grid cursor to the specified cell. |
|
Joins a block of cells into a single cell. |
|
Optimizes the width of one or more columns. |
|
Refreshes the grid to update undisplayed changes. |
|
Selects a specified sheet and brings it to the top of the grid window. |
|
Sets the background color of a cell. |
|
Set the horizontal alignment of a specific cell. The default alignment is "left". |
|
Set the vertical alignment of a specific cells. The default alignment is "vertical center". |
|
Sets the text color of a cell. |
|
Saves the contents of a 1-dimensional table to a grid column. |
|
Sets a numeric value to a grid cell. |
|
Sets number of columns in the grid. |
|
Sets the number of rows in the grid. |
|
Sets the values inside a rectangle of the grid. |
|
Sets a string value to a grid cell. |
|
Sets the label of the tab for a sheet. |
|
Sets the data type of a cell. Cells default to string data type. |
|
Sets a cell value and pixel type in the grid. |
|
Converts the grid contents to a 2-dimensional table. |
|
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 "vertical center". |
|
Breaks a block of joined cells into individual grid cells. |
Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.