CygNet Grid Methods

Scripting is not supported by TWC

Method icon The CygNet Grid supports the following scripting methods.

See Accessing Screen Objects for more information about how to view control objects in script in the Canvas application.

Refer to the Canvas Demo Screens on GitHub for examples more detail on some of these methods.

Method Description

AddRow

The AddRow method adds a row to the grid. It can include a facility tag.

Example

Copy
AddRow method
public void AddRow()

public void AddRow(FacilityTag facility)

AddRows

The AddRows method adds rows to the grid. It can take an enumerated list of facility tags.

Example

Copy
AddRows method
public void AddRows(IEnumerable<FacilityTag> facilities)

Equals

The Equals method determines whether the specified object is equal to the current object.

Export

The Export method exports data from a grid column, including its summary row, if configured. Supported formats include .csv, .html, and .txt. Export from historical columns is not supported.

Example

The following example uses a button click event and Edit Box to provide a path to export to.

Copy
Export method
Objects.CsvExportButton.Click += new EventHandler(this.CsvExportButton_Click);
Objects.HtmlExportButton.Click += new EventHandler(this.HtmlExportButton_Click);
Objects.TextExportButton.Click += new EventHandler(this.TextExportButton_Click);
Objects.EditBox1.Initialize += new EventHandler(this.EditBox1_Initialize);
 
private void EditBox1_Initialize(object sender, EventArgs args)
{
    Objects.EditBox1.Text = @"E:\temp\GridExport";
}
 
private void CsvExportButton_Click(object sender, EventArgs args)
{
    Objects.CygNetGrid1.Export(Objects.EditBox1.Text + ".csv", Canvas.Controls.Grid.GridExportFormat.Csv,true);
}
 
private void HtmlExportButton_Click(object sender, EventArgs args)
{
    Objects.CygNetGrid1.Export(Objects.EditBox1.Text + ".html",Canvas.Controls.Grid.GridExportFormat.Html,
true);
}
 
private void TextExportButton_Click(object sender, EventArgs args)
{
    Objects.CygNetGrid1.Export(Objects.EditBox1.Text + ".txt",Canvas.Controls.Grid.GridExportFormat.Text,true);
}

Focus

The Focus method sets the focus to the control to allow further operations.

GetCell

The GetCell method retrieves cell data from the grid. It returns a DataCell object.

Example

A DataCell object is in the following namespace:

Copy
GetCell method
public Canvas.Controls.Grid.CygNetGrid.DataCell GetCell(int row, int column)

A DataCell has one public method:

Copy
GetCell method
public virtual CygNet.Data.Core.FacilityTag GetAssociatedFacilityTag()

A DataCell has four public properties:

Copy
GetCell method
public CygNet.Data.Alarms.CygNetAlarmProperties.CygNetAlarmProperty AlarmDisplayProperty { get; }

public System.Windows.Media.Brush BackgroundColor { get; set; }

public CygNet.Data.Core.CygNetCoreProperties.CygNetProperty CoreDisplayProperty { get; }

public virtual object Value { get; set; }

GetCellValue

The GetCellValue method retrieves cell values from the grid. Parameters include row and column. Returns a string value.

Example

Copy
GetCellValue method
public string GetCellValue(int row, int column)

GetColumnDefinition

The GetColumnDefinition method retrieves the specified column configuration for the grid column.

GetData

The GetData method returns data in a specified data format.

GetHashCode

The GetHashCode method returns a hash code for the current object.

GetType

The GetType method returns the runtime type of the current instance.

ReceiveNewFacilities

 

ReceiveNewSiteService

 

Refresh

The Refresh method resets the cache and gets all data for the control from the associated service.

ResolveRelativeFacility

The ResolveRelativeFacility method returns the resolved relative facility.

SelectAll

The Select All method allows multi-row selection via script. If the SelectionMode property is Multiple or Extended, SelectAll will select all rows in a grid and the SelectedRows property will return the matching DataRow objects. SelectAll will not obviously change the selection if SelectionMode is Single.

SetCellValue

The SetCellValue method can be used to add custom data to the grid. Parameters include row, column, and string value. Returns a Boolean value to indicate success or failure.

Example

Copy
SetCellValue method
public bool SetCellValue(int row, int column, string value)

SetRowFacility

The SetRowFacility method sets the facility that will be used for the grid row.

ShowFacilityFilterDialog

The ShowFacilityFilterDialog method opens the CygNet Facility Filter dialog box.

ToString

The ToString method returns a string that represents the current object.

UpdateFacilityTagListFilter

The UpdateFacilityTagListFilter method changes the facility filter of the grid. The method ensures that the FacilitySource property is <Self>, updates the FacilityTagListFilter property, and then calls on the Refresh method.