Object (Screen) Methods

Scripting is not supported by TWC

Method icon The Object supports the following scripting methods.

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.

Methods Description

AddControl

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.

AddLayer

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.

CalculateRelativeTime

 

CloseScreen

The CloseScreen method closes a screen.

Equals

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

GetAllScreenControls

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

GetColorPaletteSubstitution

 

GetGlobalDictionary

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

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

GetType

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

HideLayer

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

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.

IsOrderInTypeConfiguredForDefinition

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

IsScreenOpen

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

 

NavigateToScreenByFacility

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

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

See Global Dictionary for more information about using this method.

RemoveControl

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

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

ResolveRelativeFacility

The ResolveRelativeFacility method returns the resolved relative facility.

SendFacilityBroadcast

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.

SendMessageBroadcast

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

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

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.

SetLayerVisibility

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.

SetMouseCursor

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

ShowLayer

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

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

ToString

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

WriteToGlobalDictionary

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.