The CxGrpGrid object contains the following methods:
The AboutBox method displays an About dialog box for the control.
AboutBox()
Example
The following example displays the About dialog box.
|
Sub ButtonTool_EventClick() Dim This : Set This = ButtonTool GrpGrid.AboutBox
End Sub |
The ClearCols method clears the configuration XML for all columns, leaving them blank. Do not call this method when the grid is in Run mode.
ClearCols()
Example
The following example loads CxGrpGrid with UDCs for the selected facility. This example is taken from FacNavBarAndGrpGrid.csf.
|
Sub LoadGrid()
Dim arrUdcList Dim iLowerBound Dim iUpperBound Dim strFacTag
Dim strUis strUis = FacNavBar.X.SiteService
strFacTag = FacNavBar.X.GetSelectedTargetFacTag()
If strUis = "" Then msgbox "Set the Site.Service" Exit Sub End If
If strFacTag = "" Then msgbox "Invalid FacilityTag (" + strFacTag + ")" Exit Sub End If
Dim aryFacTag, strFacility aryFacTag = Split(strFacTag, "::") strFacility = aryFacTag(1)
' ' Get the udc list for this facility. ' GetUdcList strFacTag, arrUdcList
iLowerBound = 0 iUpperBound = ubound(arrUdcList)
' ' Load up the grid rows/columns ' Dim i, j, itemid
CxGrpGrid.x.Stop CxGrpGrid.x.ClearRows CxGrpGrid.x.ClearColumns
CxGrpGrid.x.Columns = 4 For j=0 To 3 CxGrpGrid.x.ColSiteService(j) = strUis CxGrpGrid.x.ColFacility(j) = strFacility Next
CxGrpGrid.x.ColLabelText(0) = "Description" CxGrpGrid.x.ColDisplayItem(0) = 10007
CxGrpGrid.x.ColLabelText(1) = "Value" CxGrpGrid.x.ColDisplayItem(1) = 10001
CxGrpGrid.x.ColLabelText(2) = "Units" CxGrpGrid.x.ColDisplayItem(2) = 10008
CxGrpGrid.x.ColLabelText(3) = "Time" CxGrpGrid.x.ColDisplayItem(3) = 10002
For i=iLowerBound To iUpperBound CxGrpGrid.x.RowUdc(i) = arrUdcList(i) CxGrpGrid.x.RowLabelText(i) = CxGrpGrid.x.RowUdc(i) Next
CxGrpGrid.x.Start
End Sub |
The ClearRows method clears the configuration XML for all rows, leaving them blank. Do not call this method when the grid is in Run mode.
ClearRows()
Example
The following example loads CxGrpGrid with UDCs for the selected facility. This example is taken from FacNavBarAndGrpGrid.csf.
|
Sub LoadGrid()
Dim arrUdcList Dim iLowerBound Dim iUpperBound Dim strFacTag
Dim strUis strUis = FacNavBar.X.SiteService
strFacTag = FacNavBar.X.GetSelectedTargetFacTag()
If strUis = "" Then msgbox "Set the Site.Service" Exit Sub End If
If strFacTag = "" Then msgbox "Invalid FacilityTag (" + strFacTag + ")" Exit Sub End If
Dim aryFacTag, strFacility aryFacTag = Split(strFacTag, "::") strFacility = aryFacTag(1)
' ' Get the udc list for this facility. ' GetUdcList strFacTag, arrUdcList
iLowerBound = 0 iUpperBound = ubound(arrUdcList)
' ' Load up the grid rows/columns ' Dim i, j, itemid
CxGrpGrid.x.Stop CxGrpGrid.x.ClearRows CxGrpGrid.x.ClearColumns
CxGrpGrid.x.Columns = 4 For j=0 To 3 CxGrpGrid.x.ColSiteService(j) = strUis CxGrpGrid.x.ColFacility(j) = strFacility Next
CxGrpGrid.x.ColLabelText(0) = "Description" CxGrpGrid.x.ColDisplayItem(0) = 10007
CxGrpGrid.x.ColLabelText(1) = "Value" CxGrpGrid.x.ColDisplayItem(1) = 10001
CxGrpGrid.x.ColLabelText(2) = "Units" CxGrpGrid.x.ColDisplayItem(2) = 10008
CxGrpGrid.x.ColLabelText(3) = "Time" CxGrpGrid.x.ColDisplayItem(3) = 10002
For i=iLowerBound To iUpperBound CxGrpGrid.x.RowUdc(i) = arrUdcList(i) CxGrpGrid.x.RowLabelText(i) = CxGrpGrid.x.RowUdc(i) Next
CxGrpGrid.x.Start
End Sub |
The Export method exports the contents of the grid to a temporary CSV file and opens the file with the default spreadsheet viewer for the user to view and save to disk.
Export()
Example
The following example saves the grid as a spreadsheet and opens it.
|
Sub ButtonTool_EventClick() Dim This : Set This = ButtonTool GrpGrid.Export()
End Sub |
The FindCol method returns the column number matching the specified label text.
FindCol(LabelText As String) As Long
| Parameter | Required | Description |
|---|---|---|
|
LabelText |
Yes |
The column label text specifying the column to return. |
Example
The following example displays the number of the column labeled "REAL8".
|
Sub
MsgBox GrpGrid.X.FindCol("REAL8")
End Sub |
The GetCellValue method returns the value for a cell.
GetCellValue(Column As Long, Row As Long) As Variant
| Parameter | Required | Description |
|---|---|---|
|
Column |
Yes |
The zero-based index of the column to select. |
|
Row |
Yes |
The zero-based index of the row to select. |
Example
The following example displays the cell value in a message box when a cell is double-clicked.
|
Sub GrpGrid_EventDClick(Column, Row) Dim This : Set This = GrpGrid
Dim strMsg strMsg = "Cell Details" + vbCr + vbCr strMsg = strMsg + "Site.Service: " + GrpNavBar.X.SiteService + vbCr strMsg = strMsg + "Col UDC: " + GrpGrid.X.ColUdc(Column) + vbCr strMsg = strMsg + "Row Facility: " + GrpGrid.X.RowFacility(Row) + vbCr strMsg = strMsg + "Cell Value: " + GrpGrid.X.GetCellValue(Column, Row)
MsgBox strMsg
End Sub |
The GetDisplayColsXml method get the display columns as XML.
GetDisplayColsXml() As String
An example of the XML that this method will return is:
|
<XML><DisplayCols Col_0="0" Col_1="1" Col_2="2" Col_3="3" Count="4"/></XML> |
Example
The following example shows the Column XML in edtMessageBox. See ClearCols for another example.
|
Sub GrpGrid_EventDClickCol(Column) Dim This : Set This = ButtonTool
edtMessageBox.Text = GrpGrid.GetDisplayColsXml
End Sub |
The GetPointAttributeByCell method queries a grid’s cache to retrieve a point or facility attribute for a cell by the cell's column and row number. This allows the retrieval of point and facility information that may have already been compiled elsewhere on a screen.
GetPointAttributeByCell(Column As Long, Row As Long, attribute As String)
Example
The following example for GetPointAttributeByCell displays a prompt for the user to type in the point attribute they want to retrieve. It uses the values provided in the double-click event for Column and Row numbers. The retrieved point attribute is displayed in a message box.
|
Sub groupGridCntrl_EventDClick(Column, Row) Dim This : Set This = groupGridCntrl Dim strAttribute, varResult strAttribute = InputBox("Attribute?")
varResult = groupGridCntrl.X.GetPointAttributeByCell(Column, Row, strAttribute)
MsgBox CStr(varResult),,"Attribute: " & strAttribute End Sub |
The GetPointAttributeForTag method queries a grid’s cache to retrieve a tag’s attribute from a point tag. This allows the retrieval of point and facility information that may have already been compiled elsewhere on a screen.
GetPointAttributeForTag(pointTag As Variant, attribute As String)
Example
The following example for GetPointAttributeForTag displays a prompt for the user to type in the point attribute they want to retrieve.
It then uses the values provided in the right-click event for Column and Row with GetPointAttributeByCell to get the "tagfull" attribute, then uses that with the user-provided attribute in GetPointAttributeForTag. The retrieved point attribute is displayed in a message box.
|
Sub groupGridCntrl_EventRClick(Column, Row) Dim This : Set This = groupGridCntrl Dim strTag, varResult, strAttribute strAttribute = InputBox("Attribute?")
strTag = groupGridCntrl.X.GetPointAttributeByCell(column, row, "tagfull") varResult = groupGridCntrl.X.GetPointAttributeForTag(strtag, strAttribute)
MsgBox "Attribute: " & strAttribute & vbCr & CStr(varResult),,strTag End Sub |
The GetPointTag method returns the point tag for an individual cell in the tool's grid. Its syntax is as follows:
GetPointTag(Column As Long, Row As Long) As Object
Example
The following example illustrates how to "catch" the return:
|
dim pTag Set pTag=groupgrid1.X.GetPointTag (1,0) |
Also see the PointTag object.
The GetRows method returns the count of rows in the grid.
GetRows() As Long
Example
The following example displays the number of rows in edtMessageBox.
|
Sub GrpGrid_EventDClickRow(Row) Dim This : Set This = ButtonTool
edtMessageBox.Text = "There are " & GrpGrid.GetRows & " rows."
End Sub |
The GetSelectedRow method returns the zero-based index of the selected row or –1 if no row is currently selected.
GetSelectedRow() As Long
Example
The following example displays the selected row in edtMessageBox every time a new row is clicked.
|
Sub GrpGrid_EventLClickRow(Row) Dim This : Set This = ButtonTool
edtMessageBox.Text = "Row #" & GrpGrid.GetSelectedRow & " is selected."
End Sub |
The GetSingleSortColumn method returns the sort column in single column sort mode. This method is only used for a grid that has the Single Column option set for Sorting and Grouping in the OCX Properties.
GetSingleSortColumn() As Long
Example
The following example displays the sort column in a message box.
|
Sub
MsgBox GrpGrid.X.GetSingleSortColumn
End Sub |
The GetSortOrder method returns the sort order for the current sort mode. For a list of possible values returned by this method, see the ESortOrder Enumeration Table.
GetSortOrder() As ESortOrder
Example
The following example displays the current sort order in a message box.
|
Sub
MsgBox GrpGrid.X.GetSortOrder
End Sub |
The Print method prints the contents of the control, grid, or viewer. When this method is called, the Print dialog box is shown to allow configuration.
Print()
Example
The following method prints the grid contents.
|
Sub ButtonTool_EventClick() Dim This : Set This = ButtonTool
GrpGrid.Print
End Sub |
For objects, the Restart method stops and restarts Run mode. For TheFrame/TheView, the Restart method restarts TheView with new site, service, and facility information, if applicable.
Restart()
Example
The following example restarts GrpGrid.
|
Sub ButtonTool_EventClick() Dim This : Set This = ButtonTool
GrpGrid.Restart MsgBox "GrpGrid Restarted"
End Sub |
The SelectRow method selects a specified grid row. This method will return false if the specified row does not exist or is unable to be selected.
SelectRow(Row As Long) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Row |
Yes |
The zero-based index of the row to select. |
Example
The following example selects the second row displayed.
|
Sub SelRowTwo()
GrpGrid.SelectRow(1) edtMessageBox.Text = "Row 2 selected"
End Sub |
The SetCellValue method sets the value for a cell. This method will throw an error if the specified cell does not exist, or if the specified column does not permit user values.
SetCellValue(Column As Long, Row As Long, UserValue As Variant)
| Parameter | Required | Description |
|---|---|---|
|
Column |
Yes |
The zero-based index of the column to select. |
|
Row |
Yes |
The zero-based index of the row to select. |
|
UserValue |
Yes |
The value to set for the cell. |
Example
The following example sets the selected cell value to 0 when a custom context menu item is selected.
|
Sub GrpGrid_EventContextMenu(Col, Row, EventID) Dim This : Set This = GrpGrid
If EventID = "CLEAR_CELL" Then GrpGrid.X.SetCellValue Col, Row, 0 End If
End Sub |
The SetDisplayColsXml method sets the display columns from XML.
SetDisplayColsXml(DisplayColsXml As String)
| Parameter | Required | Description |
|---|---|---|
|
DisplayColsXml |
Yes |
An XML string specifying the display columns to set. |
The following is an example of a valid XML for the DisplayColsXml parameter:
|
<XML><DisplayCols Col_0="0" Col_1="1" Col_2="2" Col_3="3" Count="4"/></XML> |
Example
In the following example, the first method stores the Column XML in edtXML and the second method updates the columns with the changed XML.
|
Sub GetXml()
edtXML.Text = GrpGrid.GetDisplayColsXml edtMessageBox.Text = "XML retrieved"
End Sub
Sub SetXml()
GrpGrid.SetDisplayColsXml(edtXML.Text) edtMessageBox.Text = "XML changed"
End Sub |
The SetHistoryPaybackMode method sets the history playback mode. This method is obsolete. It is automatically called by CygNet Studio when entering History Playback Mode.
SetHistoryPlaybackMode(HistoryMode As Boolean)
| Parameter | Required | Description |
|---|---|---|
|
HistoryMode |
Yes |
Enables or disables History Playback Mode. |
Example
The following example toggles History Playback Mode on and off.
|
Sub switchModes(mode)
If mode = False Then GrpGrid.SetHistoryPlaybackMode(True) mode = True Else GrpGrid.SetHistoryPlaybackMode(False) mode = False End If edtMessageBox.Text = "History Playback Mode is set to " & mode
End Sub |
The SetHistoryPlaybackTime method sets the history playback time . This method is obsolete. It is automatically called by CygNet Studio while in History Playback Mode.
SetHistoryPlaybackTime(HistoryPlaybackTime As Date)
| Parameter | Required | Description |
|---|---|---|
|
HistoryPlaybackTime |
Yes |
The timestamp of the requested data. |
Example
The following example sets the history time.
|
Sub changeTime()
Dim newTime newTime = CDate(EditBox1.Text) 'ex. 4:00 PM 4/29/2009 GrpGrid.SetHistoryPlaybackTime(newTime) MsgBox (newTime)
End Sub |
The SetSingleSort method sets the sort column and order in single column sort mode. This method is only used for a grid that has the Single Column option set for Sorting and Grouping in the OCX Properties. This method will return false if the grid is not in single column sort mode, if the specified sort order is invalid, or if the specified column does not exist.
SetSingleSort(Column As Long, SortOrder As ESortOrder) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Column |
Yes |
The zero-based index of the column to set as the sort column. |
|
SortOrder |
Yes |
The sort order to set. For a list of possible values of this parameter, see the ESortOrder Enumeration Table. |
Example
The following example sets the first column to ascending sort mode.
|
Sub
GrpGrid.X.SetSingleSort 0, 1
End Sub |
The SetSingleSortColumn method sets the sort order in single column sort mode. This method is only used for a grid that has the Single Column option set for Sorting and Grouping in the OCX Properties. This method will return false if the grid is not in single column sort mode, or if the specified column does not exist.
SetSingleSortColumn(Column As Long) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Column |
Yes |
The zero-based index of the column to set as the sort column. |
Example
The following example sets the first column as the sort column.
|
Sub
GrpGrid.X.SetSingleSortColumn 0
End Sub |
The SetSortOrder method sets the sort order for the current sort mode. This method will return false if the specified sort order is already in use by the grid, or if the specified sort order is invalid.
SetSortOrder(SortOrder As ESortOrder) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
SortOrder |
Yes |
The sort order to set. For a list of possible values of this parameter, see the ESortOrder Enumeration Table. |
Example
The following example sets the grid to ascending sort mode.
|
Sub
GrpGrid.X.SetSortOrder 1
End Sub |
The ShowRowNumbers method shows/hides row numbers. This method will return the previous state of row number visibility. That is, if row numbers were visible prior to calling this method, it will return true; otherwise, it will return false.
ShowRowNumbers(Show As Boolean) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Show |
Yes |
Set to true to show row numbers, or set to false to hide row numbers. |
Example
The following example shows row numbers on the grid.
|
Sub
GrpGrid.X.ShowRowNumbers True
End Sub |
The Start method configures the control and starts Run mode.
Start()
Example
The following example loads CxGrpGrid with UDCs for the selected facility. This example is taken from FacNavBarAndGrpGrid.csf.
|
Sub LoadGrid()
Dim arrUdcList Dim iLowerBound Dim iUpperBound Dim strFacTag
Dim strUis strUis = FacNavBar.X.SiteService
strFacTag = FacNavBar.X.GetSelectedTargetFacTag()
If strUis = "" Then msgbox "Set the Site.Service" Exit Sub End If
If strFacTag = "" Then msgbox "Invalid FacilityTag (" + strFacTag + ")" Exit Sub End If
Dim aryFacTag, strFacility aryFacTag = Split(strFacTag, "::") strFacility = aryFacTag(1)
' ' Get the udc list for this facility. ' GetUdcList strFacTag, arrUdcList
iLowerBound = 0 iUpperBound = ubound(arrUdcList)
' ' Load up the grid rows/columns ' Dim i, j, itemid
CxGrpGrid.x.Stop CxGrpGrid.x.ClearRows CxGrpGrid.x.ClearColumns
CxGrpGrid.x.Columns = 4 For j=0 To 3 CxGrpGrid.x.ColSiteService(j) = strUis CxGrpGrid.x.ColFacility(j) = strFacility Next
CxGrpGrid.x.ColLabelText(0) = "Description" CxGrpGrid.x.ColDisplayItem(0) = 10007
CxGrpGrid.x.ColLabelText(1) = "Value" CxGrpGrid.x.ColDisplayItem(1) = 10001
CxGrpGrid.x.ColLabelText(2) = "Units" CxGrpGrid.x.ColDisplayItem(2) = 10008
CxGrpGrid.x.ColLabelText(3) = "Time" CxGrpGrid.x.ColDisplayItem(3) = 10002
For i=iLowerBound To iUpperBound CxGrpGrid.x.RowUdc(i) = arrUdcList(i) CxGrpGrid.x.RowLabelText(i) = CxGrpGrid.x.RowUdc(i) Next
CxGrpGrid.x.Start
End Sub |
The Stop method stops Run mode.
Stop()
Example
The following example loads CxGrpGrid with UDCs for the selected facility. This example is taken from FacNavBarAndGrpGrid.csf.
|
Sub LoadGrid()
Dim arrUdcList Dim iLowerBound Dim iUpperBound Dim strFacTag
Dim strUis strUis = FacNavBar.X.SiteService
strFacTag = FacNavBar.X.GetSelectedTargetFacTag()
If strUis = "" Then msgbox "Set the Site.Service" Exit Sub End If
If strFacTag = "" Then msgbox "Invalid FacilityTag (" + strFacTag + ")" Exit Sub End If
Dim aryFacTag, strFacility aryFacTag = Split(strFacTag, "::") strFacility = aryFacTag(1)
' ' Get the udc list for this facility. ' GetUdcList strFacTag, arrUdcList
iLowerBound = 0 iUpperBound = ubound(arrUdcList)
' ' Load up the grid rows/columns ' Dim i, j, itemid
CxGrpGrid.x.Stop CxGrpGrid.x.ClearRows CxGrpGrid.x.ClearColumns
CxGrpGrid.x.Columns = 4 For j=0 To 3 CxGrpGrid.x.ColSiteService(j) = strUis CxGrpGrid.x.ColFacility(j) = strFacility Next
CxGrpGrid.x.ColLabelText(0) = "Description" CxGrpGrid.x.ColDisplayItem(0) = 10007
CxGrpGrid.x.ColLabelText(1) = "Value" CxGrpGrid.x.ColDisplayItem(1) = 10001
CxGrpGrid.x.ColLabelText(2) = "Units" CxGrpGrid.x.ColDisplayItem(2) = 10008
CxGrpGrid.x.ColLabelText(3) = "Time" CxGrpGrid.x.ColDisplayItem(3) = 10002
For i=iLowerBound To iUpperBound CxGrpGrid.x.RowUdc(i) = arrUdcList(i) CxGrpGrid.x.RowLabelText(i) = CxGrpGrid.x.RowUdc(i) Next
CxGrpGrid.x.Start
End Sub |