All Canvas Control Methods

Scripting is not supported by TWC

Method icon This topic lists all methods, which are available via the Canvas script editor, for all Canvas controls, tools, and objects.

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

Browse by letter:     [A]     [C]     [D]     [E]     [F]     [G]     [H]     [I]     [N]     [R]     [S]     [T]     [U]     [W]    

Method Control Description

AcknowledgeAlarm

Button

Detail

Donut

DDS Button

Image

Linear Gauges

Navigation Buttton

SetPoint Button

Shape

Text Tool

UIS Command Button

Value Indicator

The AcknowledgeAlarm method acknowledges an alarm.

Add

Combo Box

The Add method adds an item to the Combo Box along with an associated value.

AddControl

Screen/Object

The AddControl method dynamically adds a control to a screen object at runtime.

See Adding a Control Via Script for more information about using this method.

AddFacility

Tile View

The AddFacility method dynamically adds a facility to the control runtime.

AddLayer

Map

Screen/Object

Map

The AddLayer method dynamically adds a layer to a map at runtime.

Screen/Object

The AddLayer method dynamically adds a layer to a screen object at runtime.

Example

The script call is as follows:

Copy
AddLayer method
bjects.Screen.AddLayer("Layer 1");

where "Layer 1" is the layer name.

See Scripting Layers for more information about using this method.

AddPoint

UIS Command Button

 

AddRow

Alarm Grid

CygNet Grid

Note Grid

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

Alarm Grid

CygNet Grid

Note Grid

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)

AddSeries

Chart

The AddSeries method adds a series to the chart via script. See Scripting a Chart Series for more information.

AddTab

Tab

The AddTab method adds a tab to the Tab control.

CalculateRelativeTime

Screen/Object

ChangeScreen

Nested View

The ChangeScreen method swaps one screen for another in the Nested View.

CloseScreen

Screen/Object

The CloseScreen method closes a screen.

DeleteSeries

Chart

The DeleteSeries method removes a series from a chart via script.

Dispose

Tag Chooser

The Dispose method releases unmanaged resources used by the application.

Equals

All

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

Export

Alarm Grid

CygNet Grid

Note Grid

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);
}

ExportCvs Note Grid

The ExportCsv method exports data from a Note Grid in run mode in .csv format.

ExportToImageFile

Chart

The ExportToImageFile method exports the chart to an image file.

Flip

Detail

The Flip method flips the Detail control when clicked to display a Canvas object of your choosing on the reverse side of the control.

Focus

Alarm Grid

Button

Combo Box

CygNet Grid

DDS Button

Edit Box

Navigation Button

Note Grid

Object Container

Search Box

SetPoint Button

UIS Command Button

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

GetAllScreenControls

Screen/Object

The GetAllScreenControls method retrieves all objects on a screen allowing programmatic interaction with all controls on a screen.

GetCell

Alarm Grid

CygNet Grid

Note Grid

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

Alarm Grid

CygNet Grid

Note Grid

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)

GetColorPaletteSubstitution

Screen/Object

GetColumnDefinition

Alarm Grid

CygNet Grid

Note Grid

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

GetData

CygNet Grid

Note Grid

Sparkline

The GetData method returns data in a specified data format.

GetGlobalDictionary

Screen/Object

The GetGlobalDictionary method returns the dictionary itself, allowing a script writer to manipulate the dictionary directly or inspect its contents.

Example

Copy
GetGlobalDictionary method
public Canvas.Shared.CanvasGlobalDictionary GetGlobalDictionary()

The Canvas.Shared class, "CanvasGlobalDictionary," is a C# System.Collections.Generic.Dictionary<string, object>. The string represents the key and the object represents the value. This collection allows you to store any data you want and reference it later by the key assigned when it was added. If the same key is used multiple times, the original value would be replaced by the latest update.

See Global Dictionary for more information about using this method.

GetHashCode

All

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

GetLayer

Map

The GetLayer method retrieves the specified layer from the map configuration.

GetSparklineData

Detail

The GetSparklineData method returns data in a specified data format.

GetType

All

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

HideLayer

Screen/Object

The HideLayer method dynamically hides a layer on a screen object at runtime.

Example

The script call is as follows:

Copy
HideLayer method
Objects.Screen.HideLayer("Layer 1");

where "Layer 1" is the layer name.

See Scripting Layers for more information about using this method.

Hyperlink

Screen/Object

Hyperlinking is accomplished via script using the Hyperlink method on the sending (hyperlinking) screen and the OpenedViaHyperlink event on the receiving (hyperlinked) screen. Hyperlinking is supported between screens, objects, and Nested Views in Canvas, Canvas.View, and Canvas.View.Lite. The Hyperlink method supports several modes:

  • Open — Open a designated screen in a new window (default).
  • Modal open — Open a designated screen in a new modal window. A modal window is a type of popup that is subordinate to a parent window that appears in front of the parent and usurps the parent’s control. You cannot interact with the parent window until the modal window has been closed. This type of window is used when you want a user to focus on or interact with information in the popup.
  • Open and close — Open a designated screen in a new window and close the current screen. Not supported by TWC
  • Replace — Replace the current screen with the designated screen.
  • Replace with navigation — Replace the current screen with the specified screen and add a navigation toolbar to the top of the screen. Not supported by TWC
  • Close — Close the current screen. Not supported by TWC

Optionally, you can pass a siteService, facility ID, or a data object to a hyperlinked screen.

See Hyperlinking Screens for more information about using this method.

HyperlinkReplace

Navigator

Tab

The HyperlinkReplace method replaces the active screen in the control with a facility's associated screen.

See Hyperlinking Screens and Navigation by Facility for more information about using this method.

HyperlinkReplaceWithNavigation

Navigator

Tab

The HyperlinkReplaceWithNavigation method replaces the active screen in the control with a facility's associated screen and adds a navigation toolbar.

See Hyperlinking Screens and Navigation by Facility for more information about using this method.

IsDataLoaded

Chart

Sparkline

The IsDataLoaded method is a Boolean function used to determine whether all series have finished loading historical data.

IsOrderInTypeConfiguredForDefinition

Screen/Object

The IsOrderInTypeConfiguredForDefinition method checks to see if an order in type (facility ordinal) is configured for the selected relative facility definition.

IsScreenOpen

Screen/Object

The IsScreenOpen method checks to see if a screen is open in that instance of Canvas or Canvas.View. This method is case-insensitive.

NavigateToDefaultScreen

Screen/Object

NavigateToScreenByFacility

Screen/Object

The NavigateToScreenByFacility method is included on the screen object and allows you to navigate to a specific screen by selecting a CygNet facility.

Example

The script call is as follows:

Copy
NavigateToScreenByFacility method
Objects.Screen.NavigateToScreenByFacility(facility);

The correlation between a facility and its associated screen is done via a facility attribute. You will need to configure the facility attribute that references the associated screen in your CygNet system for each facility using CygNet Explorer.

See Navigation by Facility for more information about using this method.

ReadFromGlobalDictionary

Screen/Object

The ReadFromGlobalDictionary method reads a complex script object from another screen.

See Global Dictionary for more information about using this method.

ReceiveNewFacilities

Alarm Grid

CygNet Grid

Note Grid

ReceiveNewSiteService

Alarm Grid

CygNet Grid

Note Grid

Refresh

All

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

RefreshChart

Chart

The RefreshChart method refreshes the data in the chart from the Value History Service (VHS).

RefreshTagChooser

Tag Chooser

The RefreshTagChooser method is used to trigger a data refresh at any time or after delayed loading.

Example

The following example code snippet sets a button (Button1) such that on click it’s going to load the TagChooser1.

Copy
RefreshTagChooser method
public ScreenClass()
{
    // control event handler code goes here -- do not modify
    Objects.Button1.Click += new EventHandler(this.Button1_Click);
    // add your custom initialization code here
}

private void Button1_Click(object sender, EventArgs args)
{
    Objects.TagChooser1.DelayLoading = false;
    Objects.TagChooser1.RefreshTagChooser();
}

Remove

Combo Box

The Remove method removes an item from the Combo Box.

RemoveAll

Combo Box

The RemoveAll method removes all items from the Combo Box.

RemoveControl

Screen/Object

The RemoveControl method dynamically removes a control to a screen object at runtime.

See Adding a Control Via Script for more information about using this method.

ResetMouseCursor

Screen/Object

The ResetMouseCursor method resets the mouse cursor setting for the screen.

ResolveRelativeFacility

Alarm Grid

Button

Chart

CygNet Grid

Detail

Donut

DDS Button

Image

Linear Gauges

Navigation Button

Navigator

Nested View

Note Grid

Object Container

Screen/Object

SetPoint Button

Shape

Text Tool

UIS Command Button

Value Indicator

The ResolveRelativeFacility method returns the resolved relative facility.

ReturnToStartScreen

Navigator

The ReturnToStartScreen method returns the Navigator menu to the start screen.

Select

Combo Box

Navigator

Combo Box

The Select method is available to select an item in the control via script.

Navigator

The Select method takes in a NavigationItem as a parameter and sets the ActiveItem property to that item and does not return any value. Select allows you to provide navigation items that do not exist in the navigation menu. This is how you select navigation items via script.

SelectAll

Alarm Grid

CygNet Grid

Note Grid

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.

SelectTab

Tab

The SelectTab method takes an integer and allows selection of items in the Tab control. This is how you select tabs via script.

SendFacilityBroadcast

Screen/Object

The SendFacilityBroadcast method broadcasts a facility to any open screen set to receive the facility.

See Broadcast a Message Via Script for more information about using this method.

SendMessage

Nested View

Use the SendMessage method on any nested screen to pass in a message to another nested screen. In addition to messages, you can also send and receive objects which can be used to manipulate the receiving screen, including:

  • the sending parent or child screen itself
  • message arguments that allow access to all controls and properties in the receiving screen
  • controls (for example, a grid or button)
  • data structures
  • lists

See To communicate between screens in a Nested View via script for more information.

SendMessageBroadcast

Screen/Object

The SendMessageBroadcast method broadcasts a message to any open screen set to receive the broadcast.

See Broadcast a Message Via Script for more information about using this method.

SendParentMessage

Screen/Object

The SendParentMessage method sends a message from a child screen to a parent screen.

See Broadcast a Message Via Script for more information about using this method.

SendSiteServiceBroadcast

Screen/Object

The SendSiteServiceBroadcast method broadcasts a SiteService to any open screen set to receive the SiteService.

See Broadcast a Message Via Script for more information about using this method.

SetCellValue

Alarm Grid

CygNet Grid

Note Grid

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)

SetFacilities

Heat Map

Tree Map

The SetFacilities method sets the list of facilities to be displayed in the control.

SetFacilityList

Object Container

The SetFacilityList method sets the list of facilities that will be used to instantiate objects in the container.

SetImage

Image

The SetImage method sets the dynamic image to use on the image control.

SetLayerVisibility

Screen/Object

The SetLayerVisibility method dynamically shows or hides a layer on a screen object at runtime.

Example

The script call is as follows:

Copy
SetLayerVisibility method
Objects.Screen.SetLayerVisibility("Layer 1", false);
 
Objects.Screen.SetLayerVisibility("Layer 1", true);

where "Layer 1" is the layer name.

See Scripting Layers for more information about using this method.

SetLowerAndUpperValue

Donut

Value Indicator

The SetLowerAndUpperValue method sets the lower value bound and the upper value bound via script.

SetLowerBoundValue

Donut

Value Indicator

The SetLowerBoundValue method sets the lower value bound via script.

SetMissingImage

Image

The SetMissingImage method sets the image to display if no image is configured.

SetMouseCursor

Screen/Object

The SetMouseCursor method sets the mouse cursor setting for the screen.

SetParentFacility

Object Container

The SetParentFacility method sets the parent facility that will be used (along with the facility filter) to instantiate objects.

SetRowFacility

Alarm Grid

CygNet Grid

Note Grid

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

SetServiceFilter

Tag Chooser

The SetServiceFilter method sets the filter (for a facility attribute-based Tag Chooser) to only show facilities from the provided Current Value Services.

SetSiteServiceAndFilter

Alarm Grid

The SetSiteServiceAndFilter method assists in modifying the SiteService and Filter properties without causing the control to duplicate work between each property change.

SetUpperBoundValue

Donut

Value Indicator

The SetUpperBoundValue method sets the upper value bound via script.

ShowFacilityFilterDialog

Alarm Grid

CygNet Grid

Note Grid

The ShowFacilityFilterDialog method opens the CygNet Facility Filter dialog box.

ShowLayer

Screen/Object

The ShowLayer method dynamically shows a layer on a screen object at runtime.

Example

The script call is as follows:

Copy
ShowLayer method
Objects.Screen.ShowLayer("Layer 1");

where "Layer 1" is the layer name.

ShowPopup

Screen/Object

The ShowPopup method creates a popup at the mouse location containing an object specified in the parameters. The path can be either a Canvas screen file (.can) or Canvas object file (.cob).

Example

The script call is as follows:

Copy
ShowPopup method
passtring path = @"CYGDEMO.BSSCAN\DEMO\Main.can";
Canvas.Helpers.CanvasFileSource source = Canvas.Helpers.CanvasFileSource.BSS;
CygNet.Data.Core.FacilityTag facilityTag = new CygNet.Data.Core.FacilityTag("CYGDEMO.UIS::ASH_WL");
 
Objects.Screen.ShowPopup(path, source, facilityTag);te

StartSparkline

Detail

The StartSparkline method starts the line in the Sparkline control.

ToString

All

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

UpdateDetailsControls

Tile View

The UpdateDetailsControls method updates the tiled Details controls displayed on the Tile View control.

UpdateFacilityTagListFilter

Alarm Grid

CygNet Grid

Note Grid

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.

UpdateMainScreenFacility

Tile View

The UpdateMainScreenFacility method updates the facility used for the main screen. The main screen is the Canvas screen that will be displayed when you maximize the tile and display a screen at the top of the Tile View when in run mode.

UpdateRangeAbsolute

Chart

The UpdateRangeAbsolute helper method updates chart data for an absolute date range.

UpdateRangeRelative

Chart

The UpdateRangeRelative helper method updates chart data for a relative date range.

WriteToGlobalDictionary

Screen/Object

The WriteToGlobalDictionary method saves a complex script object to a global dictionary in the Canvas application’s memory. See Global Dictionary for more information about using this method.

See Order of Event Execution for information about the order in which events are executed on a screen.