All Canvas Control Events

Scripting is not supported by TWC

Event icon This topic lists all events, which are available via the Events pane and 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.

When an event is enabled, the control will be automatically added to script and the Include in script property will be set to True.

Browse by letter:     [B]     [C]     [D]     [F]     [I]     [K]     [L]     [M]     [N]     [O]     [P]     [S]     [T]     [Z]

Event Control Description

Broadcast Message Received

Screen/Object

The Broadcast Message Received event is called when a broadcast message from another screen is received.

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

Example

Canvas.Shared.BroadcastMessageEventArgs

Copy
Broadcast Message Received event
var argument = args as .Shared.BroadcastMessageEventArgs;

See Event Argument Type for more information about EventArgs.

Click

Button

Check Box

Detail

Donut

DDS Button

Image

Linear Gauges

Radio Button

Shape

Sparkline

Text Tool

Value Indicator

The Click event is called when the user clicks once on the control with the left mouse button.

Examples

Copy
Click event
Objects.Button1.Click += new EventHandler(this.Button1_Click);
 

Objects.CheckBox1.Click += new EventHandler(this.CheckBox1_Click);

 
Objects.Image1.Click += new EventHandler(this.Image1_Click);


Objects.TextTool1.Click += new EventHandler(this.TextTool1_Click);

Close

All

The Close event is called when the screen is closed.

Controls Initialized

Screen/Object

The Controls Initialized event is called after the Initialize event has been fired on the screen and all other controls within.

Custom Context Menu Action

Alarm Grid

Button

CygNet Grid

Detail

Donut

DDS Button

Image

Linear Gauges

Navigation Button

Screen/Object

SetPoint Button

Shape

Text Tool

UIS Command Button

Value Indicator

The Custom Context Menu Action event is called when the custom context menu item is clicked. A Script event ID (configured for each custom context menu item in the Context Menu Items property for the screen or control) is passed in along with other relevant information in the context of the click, for example, facility or point tag, as appropriate.

Example

The following example shows how to use the Custom Context Menu Action event for the CygNet Grid. Substitute Grid1 with your control.

Canvas.Controls.Grid.CustomContextMenuActionEventArgs

When you click on a custom context menu item from a control, Canvas will execute the following function:

  • Grid1_CustomContextMenuAction(object sender, EventArgs args)

CustomContextMenuActionEventArgs.EventActionID indicates the Script event ID defined in the Custom Context Menu Configuration dialog box.

Copy
Custom Context Menu Action event
private void Grid1_CustomContextMenuAction(object sender, EventArgs args)

{
    CustomContextMenuActionEventArgs myargs = (CustomContextMenuActionEventArgs)args;
    MessageBox.Show(myargs.MenuItemText + " " + myargs.EventActionID + " " + myargs.FacilityTag + " " + myargs.PointTag);
}

See Event Argument Type for more information about EventArgs.

Data Load Completed

Chart

Detail

Sparkline

The Data Load Completed event is called when all series have finished loading historical data.

Double Click

Text Tool

The Double Click event is called when the user clicks twice on the Text Tool with the left mouse button.

Example

Copy
Double Click event
Objects.TextTool1.DoubleClick += new EventHandler(this.TextTool1_DoubleClick);

Double Click Cell

Alarm Grid

CygNet Grid

Note Grid

The Double Click Cell event is called when the user double-clicks on a grid cell.

Examples

Copy
Double Click Cell event for Alarm Grid
var argument = args as Canvas.Controls.Grid.AlarmGridCellDoubleClickEventArgs;

 

Copy
Double Click Cell event for CygNet Grid
var argument = args as Canvas.Controls.Grid.CygNetGridCellDoubleClickEventArgs;

See Event Argument Type for more information about EventArgs.

Facility Changed

Screen/Object

The Facility Changed event is called when the screen's facility is changed.

Example

Copy
Facility Changed event
var argument = args as Canvas.Shared.FacilityChangedEventArgs;

See Event Argument Type for more information about EventArgs.

Initialize

All

The Initialize event is called when the screen is created in preview or run mode to allow further initialization of the control.

Item Selected

Relative Facility Tree

The Item Selected event is called when an item in the hierarchy is selected. This event only fires if the Selection action is Script.

Key Down

Edit Box

The Key Down event is called when a key on the keyboard is pressed while this control has focus.

The following example shows how to use the Key Down event for the Enter key. Apply whatever actions you want to any key.

Note: In order to access to the key-related properties of the event arguments, you will need to add a reference to the WindowsBase system assembly using the Canvas Assembly Manager. After adding the reference, you will be able to safely use the System.Windows.Input.Key element. See Managing External Assemblies for more information about adding assemblies.

Example

Copy
Key Down event
#region EditBox
 
private void EditBox_KeyDown(object sender, EventArgs args)
{
    var key = (args as System.Windows.Input.KeyEventArgs).Key;
    if (key == System.Windows.Input.Key.Enter)
    {
        MessageBox.Show($"Text: {Objects.EditBox.Text}");
    }
}
 
#endregion

See Event Argument Type for more information about EventArgs.

Key Up

Edit Box

The Key Up event is called when a key on the keyboard is released while this control has focus.

The following example shows how to use the Key Up event for the Enter key. Apply whatever actions you want to any key.

Note: In order to access to the key-related properties of the event arguments, you will need to add a reference to the WindowsBase system assembly using the Canvas Assembly Manager. After adding the reference, you will be able to safely use the System.Windows.Input.Key element. See Managing External Assemblies for more information about adding assemblies.

Example

Copy
Key Up event
#region EditBox
 
private void EditBox_KeyUp(object sender, EventArgs args)
    {
        var key = (args as System.Windows.Input.KeyEventArgs).Key;
        if (key == System.Windows.Input.Key.Enter)
        {
            MessageBox.Show($"Text: {Objects.EditBox.Text}");
        }
    }
 
#endregion

See Event Argument Type for more information about EventArgs.

Live Update Changed

Chart

The Live Update Changed event is called when a chart's live update setting changes. Can be used to allow interaction between charts and controls on a screen based on live updating behavior.

Loaded

All except Screen/Object

The Loaded event is called when the control is rendered and ready for interaction.

Mouse Enter

All except Screen/Object

The Mouse Enter event is called when the mouse pointer enters (moves over) a control.

Mouse Leave

All except Screen/Object

The Mouse Leave event is called when the mouse pointer leaves (moves out of) a control.

Navigate By Facility

Screen/Object

The Navigate By Facility event is called when the screen receives a request to navigate by a specific facility tag.

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

Example

Copy
Navigate By Facility event
var argument = args as Canvas.Shared.Events.NavigateByFacilityEventArgs;

See Event Argument Type for more information about EventArgs.

Nested View Message Received

Screen/Object

The Nested View Message Received event is called when a Nested View sends a message to its parent screen.

See To communicate between screens in a Nested View via script for more information about using this event.

Example

Copy
Nested View Message Received event
var argument = args as Canvas.Shared.NestedViewMessageEventArgs;

See Event Argument Type for more information about EventArgs.

Open Via HyperLink

Screen/Object

The Opened Via Hyperlink event is called when a screen is opened via a hyperlink. The screen issuing the hyperlink must also provide a value for a data parameter; without this custom data, the event will not fire.

Example

Copy
Opened Via Hyperlink event
var argument = args as Canvas.Shared.OpenedViaHyperlinkEventArgs;

Related Links

Pan Offset Changed

Chart

The Pan Offset Changed event is called when a chart's pan offset values change. Can be used to allow interaction between charts and controls on a screen based on panning behavior.

Point Configuration Changed

Text Tool

The Point Configuration Changed event is called when a point's configuration changes.

Point Value Changed

Text Tool

Value Indicator

The Point Value Changed event is called a point's value changes.

Search Results Selected

Search Box

The Search Result Selected event is called when one of the search results is selected. This event only fires if the Selection action is Script.

See the following for more information:

Selected Cells Changed

Alarm Grid

CygNet Grid

Note Grid

The Selected Cells Changed event is called when the grid cell selection changes.

Examples

Copy
Selected Cells Changed event for Alarm Grid
var argument = args as Canvas.Controls.Grid.AlarmGridSelectionChangeEventArgs;

 

Copy
Selected Cells Changed event for CygNet Grid
var argument = args as Canvas.Controls.Grid.CygNetGridSelectionChangeEventArgs;

See Event Argument Type for more information about EventArgs.

Selection Changed

Combo Box

Heat Map

Relative Facility Tree

Tag Chooser

Tree Map

The Selection Changed event is called when the selection in the control changes or a new element is clicked.

Examples

Copy
Selection Changed event for Heat Map
var argument = args as Canvas.Controls.HeatMap.CanvasHeatMapSelectionChangedEventArgs;

 

Copy
Selection Changed event for Tree Map
var argument = args as Canvas.Controls.TreeMap.CanvasTreeMapSelectionChangedEventArgs;

See Event Argument Type for more information about EventArgs.

Notes

  • The script property, SelectedItem, can be used with the Selection Changed event to return additional information about the item selected in the Combo Box.

  • The script property, SelectedItem, can be used with the Selection Changed event to return additional information about the item selected in the Relative Facility Tree.

  • Three script properties, SelectedItem, SelectedFacilities, and SelectedPoint, can be used with the SelectionChanged event to return additional information about the item selected in the Tag Chooser.

Tab Selection Changed

Tab

The Tab Selection Change event is called when the tab selection changes.

Tooltip Opening

Button

Detail

Donut

DDS Button

Image

Linear Gauges

Navigation Buttton

SetPoint Button

Shape

Text Tool

UIS Command Button

Value Indicator

The Tooltip Opening event is called right before the tooltip opens creating a custom tooltip, which can show any desired information, for example, a value from an affiliated point, an unrelated data point, or even a CygNet note. The Tooltip mode (TooltipMode) property must be set to Script. The Tooltip Opening event supports multi-line tooltips.

Example

In the following example, a custom tooltip will be created that will retrieve and display three point values (Choke Position, SDV Valve Position, and Tubing Pressure) for the JOHNSON_WL facility on three separate lines.

Copy
Tooltip Opening example
private void TextTool1_TooltipOpening(object sender, EventArgs args)

    {
        CygNet.Data.Core.DomainSiteService Site = new CygNet.Data.Core.DomainSiteService(5410, "MYSITE", "UIS");
        CygNet.API.Points.RealtimeClient PointsClient = new CygNet.API.Points.RealtimeClient(Site);
        CygNet.Data.Core.PointTag Choke = new CygNet.Data.Core.PointTag("MYSITE.UIS:JOHNSON_WL_POACTCHO");
        CygNet.Data.Core.PointTag SDV = new CygNet.Data.Core.PointTag("MYSITE.UIS:JOHNSON_WL_POACTSDV");
        CygNet.Data.Core.PointTag Tubing = new CygNet.Data.Core.PointTag("MYSITE.UIS:JOHNSON_WL_PRTUBXIN");
        string TipValues = string.Concat("Choke Position: ", PointsClient.GetPointValueRecord(Choke).Value.ToString(), Environment.NewLine,
        "SDV Valve Position: ", PointsClient.GetPointValueRecord(SDV).Value.ToString(), Environment.NewLine,
        "Tubing Pressure: ", PointsClient.GetPointValueRecord(Tubing).Value.ToString());
        Objects.TextTool1.TooltipText = TipValues;
    }

See Event Argument Type for more information about EventArgs.

Zoom Changed

Chart

The Zoom Changed event is called when a chart's zoom values change. Can be used to allow interaction between charts and controls on a screen based on zooming behavior.

Zoom Level Changed

Map

The Zoom Level Changed event is called when the map’s zoom level changes.

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