.NET Customisation
User Guide
.NET Customisation
:
AVEVA C# Grid Control
: Grid Control API
Grid Control API
The following table includes the API calls which have been made available for the Grid Control.
Note:
Not all of the API calls have been exposed for PML use.
Note:
You can only use the AVEVA C# Grid Control on your own Visual Studio form if you have a design time license for Infragistics.
Name
Type
Purpose
Data Source methods for populating the grid
BindToDataSource(NetDataSource)
Bind Grid to NetDataSource.
BindToDataSource(NetDataSource(Boolean)
Bind Grid to NetDataSource.
Boolean - keepColumnWidths.
NetDataSource(String TableName, Array Attributes, Array AttributeTitles, Array Elements)
Data Source constructor for database Attributes and database elements. The Grid will populate itself with database attribute values. The title of each column is represented by AttributeTitles.
NetDataSource(String TableName, Array Attributes, Array Elements)
Data Source constructor for database Attributes and database elements. The Grid will populate itself with database attribute values.
NetDataSource(String TableName, Array Attributes, Array Elements, String Tooltips)
Data Source constructor for database Attributes and database elements. The Grid will populate itself with database attribute values.
NetDataSource(String TableName, Array columns, Array of Array of rows)
Data Source constructor for column headings, and a set of row data. In this case the grid does NOT populate itself with database attribute values.
NetDataSource(String TableName, Array columns, Array of Array of rows, String Tooltips)
Data Source constructor for column headings, and a set of row data. In this case the grid does NOT populate itself with database attribute values.
NetDataSource(String TableName, string PathName)
Data Source constructor for import of an Excel or CSV File
General methods available for the grid
AlignGroupHeaderVertcally(string GroupName, string Align)
Vertically align the group header (Bottom, Top, Middle, Default).
allGridEvents()
Query whether grid events are on or off
allGridEvents(Boolean)allGridEvents(Boolean)
Switch Grid Events On or Off.
AllowDropInGrid()
Query AllowDropInGrid.
AllowDropInGrid(Boolean)
Allow drag/drop in the grid.
BulkEditableGrid()
Query BulkEditableGrid.
BulkEditableGrid(Boolean)
Allow/disallow cells to be bulk editable. Bulk edit mode allows multiple cells to be selected, and Fill down/Fill up operations to be performed. Copy and Paste operations will also apply to multiple cells selected in the same column.
ClearGrid()
Remove data & column headings.
ClearGridData()
Remove all of the row data from the grid.
ColumnExcelFilter()
Query ColumnExcelFilter.
ColumnExcelFilter(Boolean)
Allow/disallow Excel style filter on columns.
ExcelFilterCaseSensitivity()
Query ExcelFilterCaseSensitivity.
ExcelFilterCaseSensitivity(Boolean)
Set Excel column filter to be case sensitive or not. Default is TRUE (case sensitive)
ColumnSetup()
Display the column setup form.
ColumnSummaries()
Query columnSummaries.
ColumnSummaries(Boolean)
Allow/disallow Average, Count, etc on numeric columns
createValueList(String Name, Array for List)
Create a value list for the grid.
DisplayNulrefAs()
Query DisplayNumrefAs.
DisplayNulrefAs(String)
Nominate (or query) a text string to be used in grid cells that hold "Nulref" reference attribute data.
DisplayUnsetAs()
Query DisplayUnsetAs.
DisplayUnsetAs(String)
Nominate (or query) a text string to be used in grid cells that hold "unset" attribute data.
EditableGrid()
Query EditableGrid
EditableGrid(Boolean)
Allow/disallow cells to be editable.
Note:
If the user is allowed to write data to the grid, then this data does not automatically get written back to the data source (or database). The BeforeCellUpdate event of the calling code is responsible for doing this synchronisation, and is in control of whether to either allow or disallow the change (Refer to
Add an Event to the Addin
for further information). This does not enable the user to add/remove rows, just to edit the content of the existing cells.
ErrorIcon()
Query ErrorIcon.
ErrorIcon(Boolean)
Allow/disallow the display of the red icon in the cell if an attribute value or expression cannot be computed.
FeedbackFailColor()
Query FeedbackFailColor.
FeedbackFailColor(String)
Nominate (or query) the colour used to highlight cells where editing fails.
FeedbackSuccessColor()
Query FeedbackSuccessColor
FeedbackSuccessColor(String)
Nominate (or query) the colour used to highlight cells successfully edited.
FixedHeaders()
Query FixedHeaders.
FixedHeaders(Boolean)
Allow/disallow fixed headers. (Useful when scrolling).
FixedRows()
Query FixedRows.
FixedRows(Boolean)
Allow/disallow fixing of rows (Useful when scrolling).
getDataSource()
NetDataSource
Returns the data source that has been set in the grid.
getGroups
Returns list of groups used in grid.
GetGroupOrigin(string grKey)
Return the origin of the given group.
GetGroupSpan(string grKey)
Return the span of the given group.
GridHeight()
Real
Query GridHeight.
GridHeight(Real)
Set the height of the rows in the grid.
getParentGroupForGroup(string groupName)
Returns parent's group name for given group.
getParentGroupForColumn(string colName)
Returns parent's group name for given column.
GroupMoving(String)
Set the moving of groups to: Default, NotAllowed, WithinBand or WithinGroup.
HeaderSort()
Query HeaderSort.
HeaderSort(Boolean)
Allow/disallow the user to sort columns.
HideGroupByBox()
Query HideGroupByBox.
HideGroupByBox(Boolean)
Hide/show the groupBy box.
loadFromMemoryStream(object data)
Load the grid from a stored memory stream.
loadGridFromXML(string xmlFile)
Load the grid from an XML file.
loadGridLayout(object gridLayout)
Load the stored layout of a grid.
loadLayoutFromXml(String)
Load a stored grid layout into the current grid instance.
OutlookGroupStyle
Query OutlookGroupStyle.
OutlookGroupStyle(Boolean)
Allow/disallow the Outlook Group style feature.
printPreview()
Opens a Print Preview of the grid instance (which also allows printing).
QuickReport()
Create a quick report from the current grid.
ReadOnlyCellColor()
Query ReadOnlyCellColor.
ReadOnlyCellColor(String)
Nominate (or query) the background colour used to indicate cells where editing is not permitted.
RefreshAllFilters()
Refresh all the filters in the grid.
RefreshTable()
For a grid displaying Dabacon data this recalculates the content of every cell to refresh to the latest database state.
RefreshVisibleRegion()
For a grid displaying Dabacon data this recalculates the content of every cell in the visible region to refresh to the latest database state.
resetCellFeedback()
Reset the cell editing feedback highlight colour and tooltip text.
ResetColumnProperties()
Reset column layout.
ResetGridOrder()
Reset the order of the columns in the grid.
saveGridToExcel(string excelFile)
Save the grid data to an Excel file.
Note:
This will retain all grid groupings and layout of data. The String should specify the full pathname.
saveGridToExcel(string excelFile, string worksheet)
Save the grid data to a designated worksheet of an Excel file. Note that this will retain all grid groupings and layout of data.
saveGridToExcel(string excelFile,string worksheet, string strHeader)
Save the grid data to a designated worksheet of an Excel file. Here strHeader is a user supplied string which is output to the first row in the Excel spreadsheet. The grid data is then output starting in row #2.
SaveLayoutToXml(String)
Save the grid layout (not data) to a file on the file system.
saveToMemoryStream(ref MemoryStream stream)
Save the grid to a memory stream.
setAlternateRowColor(Red Num, Green Num, Blue Num)
Set alternate rows of the grid to a different colour. The default is: (251, 251, 255).
setAlternateRowColor(String)
Set alternate rows of the grid to a different colour.
setLabelVisibility(Boolean)
Show/hide the label which indicates the number of rows in the grid.
SingleRowSelection()
Query SingleRowSelection.
SingleRowSelection(Boolean)
Set grid to single row selection.
splitGrid(Boolean)
Allow/disallow the user to split the grid horizontally and vertically.
SetGroupOrigin(string grKey, Point value)
Set of the {x,y} origin of the given group.
storeGridLayout()
Store the layout of the grid.
SetGroupSpan(string grKey, Point value)
Set of the {x,y} span of the given group.
SyntaxErrorColor()
Query SyntaxErrorColor.
SyntaxErrorColor(String)
Nominate (or query) the colour used to highlight cells containing syntactically invalid data.
Methods on rows in the grid
addRow(Array)
Add a single row of data. If the grid is based on database elements then the first element of the array is read. If not, then the Array data represents the data in each cell of the row.
clearRowSelection()
Clear row selection.
deleteRows(Array)
Delete one or more rows by row tag.
deleteSelectedRows()
Delete selected rows.
GetFilteredInRows()
Array
Return the rows which are contained in the current filter.
GetFilteredOutRows()
Array
Return the rows which are not contained in the current filter.
getNumberRows()
Real
Get the number of rows in the grid.
getNumberSelectedRows
Real
Get the number of selected rows in the grid.
getRow(Real)
Get the row data.
getRow(string row)
Array
Get the cells in the row with the specified row tag.
getRowNumFromTag(string rowTag)
Get the row number from the row tag.
getRows()
Array of Array (rows)
Returns an array of all the row data.
getRowTag(Real)
Get the row tag.
getRowTagByListIndex(Real)
Get the row tag by list index.
GetSelectedRows()
Array of Array (rows)
Returns array of selected rows.
GetSelectedRowColumn(row, column))
Get the row and column of the selected row.
getSelectedRowTags()
Array of row tags
Get the selected row tags.
getVisibleIndexOfRow(string strRowTag)
Get the visible index of the row.
HasFilteredRows(Boolean)
Set whether the grid has filtered rows.
isRowVisible(Real)
Is the given row visible.
MoveRowToPosition(Real, Real)
Move a row to a given position in the grid.
MoveRowToPosition(String, Real)
Move a row to a given position in the grid.
MoveSelectedRowsDown()
Move the selected rows down in the grid.
MoveSelectedRowsUp()
Move the selected rows up in the grid.
returnSelectedRows(Array)
Return the selected rows.
RowAddDeleteGrid()
Query RowAddDeleteGrid.
RowAddDeleteGrid(Boolean)
Enable/disable row addition and deletion in the grid.
ScrollSelectedRowToView()
Query ScrollSelectedRowToView.
ScrollSelectedRowToView(Boolean)
Scroll the selected row into view.
selectAllRows()
Select all the rows in the grid.
selectRow(Real)
Select the given row.
setEditableRow(Real, BoolenanBoolean)
Set the given row as editable or not.
setRowColor(Real, string strColorcolour)
Set the colour of the row to the named value.
SetRowColor(string rowTag, string colour)
Set the colour of the row to the named value.
SetRowColor(string row, real red, real green, real blue)
Set the colour of the row to the RGB value.
setRowTooltip(Real, string tooltip)
Set row tooltip to the specified string.
setRowTooltip(string row, string tooltip)
Set row tooltip to the specified string.
setRowVisibility(Real, Boolean)
Set the visibility of the row.
setSelectedRows(Array)
Select the given rows.
setSelectedRowTags(Array)
Programmatically select the given row tags.
Methods on columns in the grid
AlignColumnHeaderVertcally(string ColumnName, string Align)
Align the given column header vertically: Default, Top, Middle or Bottom.
assignBiCheckboxToColumn(Real)
Assign a bi-checkbox to the given column.
assignDataTypeToColumn(Real)
Assign data type “double” to the given column.
assignOptionSetToColumn(Real)
Assign a Yes/No option set to the given column.
assignValueListToColumn(String, Real)
Assign a value list (string) to the given column.
AutoFitColumns()
Resize columns to fit widest text.
CheckFixedHeaderIndicatorOnColumn(String)
Query FixedHeaderIndicatorOn Column.
CheckFixedHeaderOn Column(String)
Query FixedHeaderOnColumn.
ColumnsInGroupByBox()
Boolean
Returns true if there is at least one column in the GroupBy box.
ColumnMoving(String)
Allow/disallow column moving on the given column.
ColumnDisplayedAndSortedAscending(string key)
Set given column as displayed and sorted in ascending order.
ExtendLastColumn()
Query ExtendLastColumn.
ExtendLastColumn(Boolean)
Extend the last column.
FixedHeaderIndicatorOn Column(string column, Boolean)
Set fixed header indicator on the given column.
FixedHeaderOnColumn(string column, Boolean)
Fix the header on the column.
getColumn(Real)
Get the cells in the column.
getColumn(string column)
Array
Get the cells in the column with a specified tag.
GetColumnIndex(string colKey)
Get the column index of the given column.
getColumnKey(Real)
Get the key of the given column.
getColumnMask (Real)
Get the mask of the given column.
GetColumnOrigin(string colKey)
Get the column origin of the given column.
getColumnPosition(string column)
Real
Get the position of the column with the specified tag.
GetColumnSpan(string colKey)
Get the span of the given column.
GetColumnTitle(string column)
String
Get the title of the column with the specified tag.
getColumns()
Array of STRING
Get the columns in the grid.
getColumnsWithFilters()
Array of STRING
Get the columns in the grid with filters.
getTitles()
Array of strings
Get the titles for the columns in the grid.
getNumberColumns()
REAL
Return the number of columns.
GetSetFiltersOfGivenColumn(string col)
Get filters that are set in given column name.
q var !!PMLGridExample.grid.GETSETFILTERSOFGIVENCOLUMN(!columnName)
getUserColumns()
Array
Get the columns in the column setup window.
GetUserColumnSpecifications
Array
Get the column specifications in the column setup window.
getUserTitles()
Array
Get the column titles in the column setup window.
Hashtable GetColumnsWithFilters()
Return all columns in the grid with filters.
isColumnVisible(Real)
Boolean
Query the visibility of the given column.
isColumnVisible(string column)
Boolean
Query the visibility of the specified column.
ResetColumnFilters()
Reset all of the column filters.
ResizeAllColumns()
Resize columns to fit in available width of form.
selectCell (Real, Real, Boolean)
Select/deselect the cell (row, column).
setColumnColor (Real, string colour)
Set the column colour to a string.
setColumnColor(string column, string colour)
Set the column colour to a string, for example, red.
setColumnImage(Real, string strImageFile)
Set the column image.
setColumnMask(Real, string strMask)
Set the column mask.
SetColumnOrigin(string colKey, Point value)
Set the origin of the given column.
setColumnPosition(string, realPoint value)
Set the position of the given column.
SetColumnSpan(string colKey, Point value)
Set the span of the given column.
setColumnTextAlignment(string column, string alignment)
Set the alignment of text in the column to CENTRE, CENTER, LEFT or RIGHT
setColumnVisibility(Real, Boolean)
Show/hide the specified column.
setColumnVisibility(String, Boolean)
Show/hide the specified column.
SetColumnWidth(Real, Real)
Set the column to a designated width.
SetColumnWidth(string column, real width)
Set the column to a designated width.
setColumnsWithFilters(Array)
Set the columns in the grid with the specified filters.
SetColumnWithFilters(string colName, Hashtable paramValues)
Set the column in the grid with specified filters and column names. This function requires to set columns and values in correct order, otherwise it won't set correctly
show !!PMLGridExample
!x[0] = '/E1301'
!x[1] = '/C1101'
!y[0] = 'EQUI'
!z[0] = !x
!z[1] = !y
!columnsName[0] = 'Name'
!columnsName[1] = 'Type'
q var !!PMLGridExample.grid.SETCOLUMNSWITHFILTERS(!columnsName,!z)
SetColumnWithFilters(string colName, Hashtable paramValues)
Set the column in the grid with the specified filters.
show !!PMLGridExample
!values = object array()
!values[0] = '/E1301'
!values[1] = '/C1101'
!values[2] = '/1302A'
!columnName = 'Name'
q var !!PMLGridExample.grid.SETCOLUMNWITHFILTERS(!columnName,!values)
setEditableColumn(Real, Boolean)
Set the given column to be editable/uneditable.
setGroupByColumn(Real, Boolean)
Set the ability to group by column.
setNameColumnImage()
Displays standard icons in a "NAME" attribute column when database elements are used.
setNameColumnImage(boolean keepColumnWidth)
Displays standard icons in a "NAME" attribute column when database elements are used.
Additional parameter to set whether or not to maintain the column width.
sortColumnAscending(String)
Sort in ascending order the specified column.
sortColumnsAscending(Array)
Sort in ascending order the specified columns.
SortedColumnCollection()
Array
Get the sorted columns,
unsetNameColumnImage()
Remove the standard icons in the “NAME” attribute column when database elements are used.
Methods on cells in the grid
assignValueListToCell(String, Real, Real)
Assign the given value list to the cell (row, column).
DoDabaconCellUpdate(Array args)
This function is provided to support user code in the BeforeCellUpdate event when the grid is displaying Dabacon element/attribute data. The array provided as argument to the BeforeCellUpdate event can be passed on to this function to modify the Dabacon element/attribute in synchronisation with the cell data. If the function is unable to perform the modification for any reason the Array[3] and Array[4] values will be set to indicate the problem. Refer to
Add an Event to the Addin
for further information.
DoDabaconElementCopy(Array args)
Do a Dabacon Element copy.
DoDabaconElementCreateAtPosition(Array args)
Do a Dabacon Element create at position in the hierarchy.
DoDabaconElementCreateFirst(Array args)
Do a Dabacon Element create at the first position in the hierarchy.
DoDabaconElementCreateLast(Array args)
Do a Dabacon Element create at the last position in the hierarchy.
DoDabaconElementDelete(Array args)
Do a Dabacon Element delete.
DoDabaconElementOrderUpdate(Array args)
Do a Dabacon element order update.
getCell(Real, Real)
Get the content of the cell in the specified row and column.
getCell(string rowTag, string columnTag)
STRING
Get the content of the cell in the specified row and column.
getCellByListIndex(string rowTag, string colTag)
Get the cell by list index.
isEditableCell(string strRowTag, string strColTag)
Boolean
Get whether or not the cell is editable.
removeValueListFromCell (Real, Real)
Remove the value list from the cell.
setCellColor(string rowTag, string columnTag, string colour)
Set the colour of a cell, for example: red.
setCellColor(string rowTag, string columnTag, real red, real green, real blue)
Set the colour of the cell to the RGB value.
setCellColor(Real, Real, Real, Real, Real, Real)
Set the colour of the cell to the RGB value.
setCellColor(Real, Real, String)
Set the colour of the cell.
setCellImage(Real, Real, String)
Set the image of the cell.
setCellImage(Real, Real, Image)
Set the image of the cell.
setCellTextAlignment(string rowTag, string columnTag, string alignment), where alignment=CENTRE, CENTER, LEFT, RIGHT
Set the alignment of text in the cell to CENTRE, CENTER, LEFT or RIGHT.
setCellTooltip(Real, Real, string strToolTip)
Set the tooltip of the cell.
setCellValue(Real, Real, string strVal)
Set the value of the cell.
setCellValue(string rowTag, string columnTag, string value)
Set a value in the cell.
setCellValueByListIndex (Real, Real, string strVal)
Set a value in the cell by list index.
setCellValueByListIndex(string rowTag, string columnTag, string value)
Set a value in the cell by list index.
setEditableCell(Real, Real, Boolean editable)
Enable/disable cell editing.
setEditableCell(string rowTag, string columnTag, Boolean editable)
Enable/disable cell editing.
setSelectedCellsValue(string strVal)
Set the value for all selected cells.
Other methods
Updates()
Query updates.
Updates(Boolean)
Set whether or not database updates should be applied to the grid.
setErrorIcon(Image, Image)
Set the image of the icon to appear in a Dabacon grid when an error is generated.
LayoutFromColumnSpecs(bool keepColumnWidths)
Refresh layout of all columns.
MenuTool PopupMenu
Set the popup menu for the grid.
MenuTool PopupMenuHeader
Set the popup menu for the header of the grid.
RefreshGroupSort()
Refresh group sort (can be used when a new item is added).
CellSort : IComparer
The IComparer class to sort two grid cells.
Compare(object x, object y)
The compare algorithm to sort two grid cells
SuspendUpdates(Boolean)
Suspend updates to the grid.
DisplayStyle CellValueListDisplayStyle
The cell Value List display style (Always, OnMouseEnter, OnCellActivate, OnRowActivate).
Dictionary<string, ColumnLayout> GetCurrentColumnLayout()
Gets the layout detail for each column.
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.