Scripting > CxHmiGcm > NomGridCtrl Object > NomGridCtrl Methods

NomGridCtrl Methods

The CygNet GCM Nomination Grid Control object contains the following methods:

AboutBox

The AboutBox method displays an About dialog box for the control.

Syntax

AboutBox()

Example

The following example displays the CygNet About dialog box.

Sub ShowAboutBox()

NomGridCtrl.AboutBox

End Sub

ApplyUnitSet

The ApplyUnitSet method changes the current units to a predefined set.

Syntax

ApplyUnitsSet(nUnitsSet As Integer)

Parameters

Parameter Required Description
nUnitsSet Yes

The unit set number indicated in the set name.

Example

Sub cboDisplayUnitSet_EventChange()

Dim This : Set This = cboDisplayUnitSet

Dim iSelection

iSelection = this.Selection

 

'NomGridCtrl1.StopAllActivity

 

If iSelection = 0 Then

NomGridCtrl1.ApplyUnitsSet 0

Elseif iSelection = 1 Then

NomGridCtrl1.ApplyUnitsSet 1

Else

msgbox "Invalid selection of " & iSelection, vbOkonly, "Unexpected Error"

End If

 

On Error Resume Next

Dim iRebuildResult

iRebuildResult = NomGridCtrl1.Rebuild()

 

If iRebuildResult <> 0 Then

msgbox "Grid rebuild failed with code " & iRebuildResult, vbOkonly, "Rebuild Error"

End If

 

End Sub

Back to top

Clear

The Clear method clears the contents and values of the object.

Syntax

Clear

Remarks

Example

The following example will clear all values from the GCM Nomination Grid.

Sub Clear()

NomGridCtrl.Clear

End Sub

Back to top

Export

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.

Syntax

Export()

Example

The following example exports the data in the GCM Nomination Grid to a CSV file.

Sub NomGridCtrl1_EventRefreshComplete()

Dim This : Set This = NomGridCtrl1

If bIsExported = False Then

this.Export

bIsExported = True

End If

End Sub

Back to top

ExportToFile

The ExportToFile method exports the contents of the grid to a specified CSV file.

Syntax

ExportToFile(strExportFileFullPathName As String)

Parameters

Parameter Required Description

strExportFileFullPathName

Yes

The file path or blob path to the CSV file to receive the exported data.

Example

The following example exports the data in the GCM Nomination Grid to a CSV file located at C:\GcmExport.csv.

Sub ExportToFileButton_EventClick()

NomGridCtrl1.ExportToFile "C:\GcmExport.csv"

End Sub

Back to top

GetCellText

The GetCellText method gets the text of the cell specified by row and column.

Syntax

GetCellText(nRowIndex As Integer, nColumnIndex As Integer) As String

Parameters

Parameter Required Description

nRowIndex

Yes

The zero-based index of the row to select.

nColumnIndex

Yes

The zero-based index of the column to select.

Example

The following example returns the text of the cell specified by row and column.

strCellText = NomGridCtrl1.GetCellText(1, 0)

Back to top

GetCellTextByFacility

The GetCellTextByFacility method gets the text of the cell specified by given Facilty and column.

Syntax

GetCellTextByFacility(strFacTag As String, nColumnIndex As Integer) As String

Parameters

Parameter Required Description

strFacTag

Yes

The tag of the facility for which to retrieve a value.

nColumnIndex

Yes

The zero-based index of the column to select.

Example

The following example gets the text of column 0 for the facility LVL1_1.

strCellText = NomGridCtrl1.GetCellTextByFacility("MY_SITE.UIS::LVL1_1", 0)

Back to top

Print

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.

Syntax

Print()

Example

The following method prints contents of the CygNet GCM Nomination Grid control when a button is pressed.

Sub ButtonTool1_EventClick()

Dim This : Set This = ButtonTool1

NomGridCtrl.Print

End Sub

Back to top

Rebuild

The Rebuild method re-reads the Group Service (GRP) hierarchy and Current Value Service (CVS), then redraws the grid and refreshes the data.

Syntax

Rebuild As Integer

Example

Sub NomGridCtrl1_EventInitialize()

Dim This : Set This = NomGridCtrl1

this.HistoricalDate = now()

this.Rebuild

bIsExported = False

End Sub

Back to top

Refresh

The Refresh method refreshes the contents of the control from the Current Value Service (CVS).

Syntax

Refresh()

Example

The following example refreshes the CygNet GCM Nomination Grid control when a button is pressed.

Sub ButtonTool1_EventClick()

Dim This : Set This = ButtonTool1

NomGridCtrl1.Refresh

End Sub

Back to top

StopAllActivity

The StopAllActivity method stops all work if the grid is building. Call this method when closing the screen.

Syntax

StopAllActivity As Integer

Example

See example above for ApplyUnitSet.

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.