The Nested View has numerous properties available for configuration in the Properties pane. The following topic describes a basic workflow for configuring this control. The specific appearance and functionality of the object you create depends on your needs and implementation of the control's properties, each of which is described below.
Use the Settings pane to apply common settings (sizing, grouping, alignment, etc.) to this object (and others) on your screen.
The Style property defines the style sheet applied to an object on a screen. A style sheet consists of a predetermined list of properties and property values configured for a particular control type.
Styles are created in two ways:
Tip: You can also change a control's Style on the Controls view of the Screen pane.
The Include in script check box indicates that the control will appear in the objects collection of the screen (if scripting is enabled). To optimize performance, best practice dictates that you only include the controls you need to manipulate via script. Other controls should be excluded. When you add an event to a control, it will be automatically added to script and the Include in script property (and the In Script check box on the Controls view) will be set to True.
Tip: You can also change the Include in Script setting on the Controls view of the Screen pane.
This property specifies the source to the file, image, object file, or screen. Options include:
The default file source is Local.
Linking between Canvas screens, objects, and nested views is quite flexible. You don't need to specify the service or folder information in the path to find related screens, objects, or nested views, although you can if desired. When specifying a path to another file, the following notes apply:
If the screen or object file is in the APPS or BSS, you can specify the:
If the screen or object file is in the local file system, you can specify the:
The Height property specifies the height of the control (or screen).
Tip: You can also change the height of a control using the Settings pane (click on the
(Settings) to the right of the control in design mode) or on the Controls view of the Screen pane.
The Horizontal resize mode property specifies whether and how the control dynamically moves or resizes horizontally when the screen is resized in run mode. Options include:
The default value is None.
The Layer property specifies the layer for this control. Layers are used to show, hide, and edit multiple controls on one layer without affecting controls on another layer.
Tip: You can also edit a control's Layer on the Controls view of the Screen pane.
The Vertical resize mode property specifies whether and how the control dynamically moves or resizes vertically when the screen is resized in run mode. Options include:
The default value is None.
The Width property specifies the width of the control (or screen).
Tip: You can also change the width of a control using the Settings pane (click on the
(Settings) to the right of the control in design mode) or on the Controls view of the Screen pane.
The X property specifies the location of the control along the horizontal axis. Use the up, down, left, and right arrow keys to nudge a control by 1 pixel. Arrow moves a control by 1 pixel. Ctrl+Arrow moves a control by 10 pixels. Ctrl+Shift+Arrow moves a control by 100 pixels.
Tip: You can also change the location of the control using the Settings pane; click on the
(Settings) to the right of the control in design mode.
The Y property specifies the location of the control along the vertical axis. Use the up, down, left, and right arrow keys to nudge a control by 1 pixel. Arrow moves a control by 1 pixel. Ctrl+Arrow moves a control by 10 pixels. Ctrl+Shift+Arrow moves a control by 100 pixels.
Tip: You can also change the location of the control using the Settings pane; click on the
(Settings) to the right of the control in design mode.
The Z index property is used to determine the order in which controls are layered on top of each other. Controls with higher values will draw on top of those with lower values. The newest control added to a screen will always have the highest value and will be the top layer. Two or more controls can be on the same index (layer).
Tip: You can also change the Z index of a control using the Settings pane (click on the
(Settings) to the right of the control in design mode) or on the Controls view of the Screen pane.
The source of your CygNet data can be explicitly configured for the control or it can be inherited from the screen or another control.
The Selection mode property is used to determine how the control will receive CygNet information from other controls. Two options are available; click the desired radio button:
Some controls on the same screen allow for the sending of facility tag information from one control to another.
Canvas has streamlined the mechanism for communicating from a parent screen down to a child screen and from a child screen up to a parent screen allowing for more refined sub-screen messaging and manipulation. A parent screen can call on a nested screen to pass in a message and/or an object to a child nested screen and vice versa.
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:
In the following examples, a parent screen calls on the nested view to pass in a message to the child screen ("Message from Parent to Child") and includes an object, which can be anything the sender wants. In this case, the sender (the child screen) sends a reference to its screen properties to the receiver (the parent screen). Since now the parent’s script has a reference to the child’s screen properties, the parent can make changes to those properties, such as changing the SiteService or facility. Here, it changes the child screen’s background color to orange.
In the second example, the child screen returns a message ("Message from Child to Parent") and includes an object to change the parent screen’s background color to pink.
Example — Send and receive a message or object from a parent screen
The following code example shows how a parent screen sends and receives a message and object:
|
{ public class ScreenClass { public static void Main() { ScreenClass c = new ScreenClass(); } public ScreenClass() { // control event handler code goes here -- do not modify Objects.Button1.Click += new EventHandler(this.Button1_Click); Objects.Screen.NestedViewMessageReceived += new EventHandler(this.Screen_NestedViewMessageReceived); Objects.Button2.Click += new EventHandler(this.Button2_Click); } #region Button2 private void Button2_Click(object sender, EventArgs args) { // send a message from the Parent to the nested Child screen Objects.View1.SendMessage("Message from Parent to Child", Objects.Screen); } #endregion
#region Screen private void Screen_NestedViewMessageReceived(object sender, EventArgs args) { // process message sent from the nested Child screen var messageArguments = args as NestedViewMessageEventArgs; var child = messageArguments.Data as CanvasScreenPropertiesViewModel; MessageBox.Show("Message received from nested screen: " + messageArguments.ID); child.BackgroundColor = "Orange"; } #endregion #region Button1 private void Button1_Click(object sender, EventArgs args) { // send a message from the Parent to the nested Child screen Objects.View1.SendMessage("Message from Parent to Child", Objects.Screen); } #endregion } } |
Example — Send and receive a message or object from a child screen
The following code example shows how a child screen sends and receives a message and object:
|
{ public class ScreenClass { public static void Main() { ScreenClass c = new ScreenClass(); } public ScreenClass() { // control event handler code goes here -- do not modify Objects.Button1.Click += new EventHandler(this.Button1_Click); Objects.Screen.NestedViewMessageReceived += new EventHandler(this.Screen_NestedViewMessageReceived); } #region Screen private void Screen_NestedViewMessageReceived(object sender, EventArgs args) { // process message sent from Parent var messageArguments = args as NestedViewMessageEventArgs; var parent = messageArguments.Data as CanvasScreenPropertiesViewModel; MessageBox.Show("Message received: " + messageArguments.ID); parent.BackgroundColor = "Pink"; } #endregion
#region Button1 private void Button1_Click(object sender, EventArgs args) { // send message from Child to Parent Objects.Screen.SendParentMessage("Message from Child to Parent", Objects.Screen); } #endregion } } |