Object (Screen) Events

Scripting is not supported by TWC

Event icon The Object supports the following scripting events. Click next to any event name in the Events pane to see a short description for the selected event.

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

Note: In script, the Object container is always referred to as Screen.

Event Description

Broadcast Message Received

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.

Close

The Close event is called when the screen is closed.

Controls Initialized

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

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.

Facility Changed

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

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

Navigate By Facility

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

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.

Opened Via Hyperlink

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

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