Using DashBoard Visual Logic

This section describes how to use the DashBoard visual Logic editor to add ogScript functionality to your panels.

Tip: The DashBoard Visual Logic editor is also a handy tool for learning ogScript syntax. You can add and connect blocks in the Visual Logic editor, then view the resulting ogScript code on the Source tab.

 

Topics in this section include:

Creating and Populating a New CustomPanel

Editing ogScript Code in Existing CustomPanels

Importing External APIs from Saved Files

Adding ogScript-Based Items to the Component Tree

Adding and Linking Logic Blocks

Adding Devices

Adding Panel Parameters

Adding Local Variables

Adding Logical Controls and Math Operations

Creating New Functions

Creating and Populating a New CustomPanel

The DashBoard Visual Logic editor helps you create ogScript code segments to add functionality to components in CustomPanels. Before you can use Visual Logic, you have to create the CustomPanel components that the ogScript code will manipulate.

To create and populate a CustomPanel:

1.Create a new CustomPanel.

The panel can be any type, but if you want to use parameters, it must include a data source.

For more information, see Creating a CustomPanel.

2.Populate the panel with components you want to include, such as buttons, labels, parameters, and timers.

For more information, see Adding Basic Components, Adding Data-Backed Components, and Timers.

3.If you want to control or monitor a device that appears in the basic tree, add any device control from the device to your CustomPanel. All the device’s functions and parameters are made available.

For more information about how to add a device control to your CustomPanel, see Adding Device Editors, Device Summaries, and Device Controls.

Editing ogScript Code in Existing CustomPanels

You can edit ogScript code segments in existing panels. If the code was created using Visual Logic and was never edited manually, you can edit it in the Visual Logic editor. Otherwise, it can be edited manually only.

This section describes how to access ogScript code segments associated with existing CustomPanel components and Component Tree items.

To access existing ogScript code segments:

1.Open the CustomPanel.

2.Press Ctrl+g or click the PanelBuilder Edit Mode button to enter Edit Mode.

3.Double-click the panel to open the Edit Component window.

4.In the Component Tree, click the item you want to edit.

The following types of Component Tree items are ogScript code segments: api, ogscript, task, timertask.

On the Attributes tab for the item, the ogScript is available for editing. If the Visual button is blue, the ogScript was created and edited only in Visual Logic, and can be edited in the Visual Logic editor. If the ogScript button is blue, the code can be edited manually only.

Tip: When you are finished editing the ogScript code, be sure to Apply Changes.

Importing External APIs from Saved Files

You can import external API script files into your CustomPanel. Importing an API enables you to call the API functions from your CustomPanel. They become available in the Visual Logic editor.

Note: External API script files are imported by reference, so if the original API script file changes, your CustomPanel may be affected.

To import an external API

1.In your CustomPanel, in Edit Mode, double-click the CustomPanel.

The Edit Component window appears.

2.In the Component Tree, click the top-level container item (usually abs).

3.In the Insert Tags area, click the <api/> button.

An api item appears within a meta folder below the selected container.

4.On the Api Attributes tab, in the General Attributes section, specify a Name and an ID for the api item.

5.Beside the Script File Location box, click Browse, browse to the API script file, and then click Open.

Tip: API script file names typically have a .ogscript file extension.

6.Click Apply Changes.

The functions from the imported API script file are available in the Control and APIs panel of the Visual Logic editor.

Adding ogScript-Based Items to the Component Tree

The following types of Component Tree items can include ogScript code segments created using the Visual Logic editor:

api items (<api/> tags)

ogscript items (<ogscript> tags)

task items (ogScript tasks can be assigned to buttons, labels, parameters, and listeners)

timertask items (ogScript tasks can be assigned to timers)

 

To add an ogScript-based item to the Component Tree:

To create a standalone segment of ogScript code that can be referenced from within the panel:

a.In the Component Tree, click the container item where you want the ogScript-based item to appear.

b.In the Insert Tag area above the Component Tree, click the <ogScript/> button.

A new ogscript item appears in the Component Tree.

The Visual Logic editor appears.

c.In the General Attributes area, specify a Name and ID for the ogScript code segment.

To create ogScript code for a new ogScript task assigned to an existing button, label, parameter, timer, or listener:

a.In the Component Tree, click the item to which you want to assign the new ogScript task (button, label, parameter, timer, or listener).

The Edit Component window appears.

b.In the Tasks area, click Add.

The Add Task window appears, with the Task Type set to ogScript and the Visual Logic editor open by default.

To create an API with callable functions:

a.In the Component Tree, click the container item where you want the new API to appear.

b.In the Insert Tag area above the Component Tree, click the <api/> button.

A new api item appears in the Component Tree.

The Visual Logic editor appears.

c.On the Api Attributes tab, in the General Attributes area, specify a Name and an ID for the new API.

d.If you want the script in the API to be executed immediately, before the rest of the panel is loaded, select the Execute Immediately check box.

When this option is selected, the script in the <api/> tag is evaluated as soon as it is reached, during the panel build process. This allows the script to create global functions that can be called from anywhere in the panel, create new parameters on the fly, and modify constraints of parameters even before they are displayed.

For more information about creating an API, see Creating Internal and External APIs.

Adding and Linking Logic Blocks

To create ogScript code segments in Visual Logic, you drag logic blocks into the workspace and then link them to define their logical relationships.

You can drag logic blocks into the workspace from the Devices and Parameters panel, the Local Variables panel, and the Control and APIs panel.

Tip: As an alternative to dragging, you can double-click the logic block to add it to the workspace.

To link logic blocks, you click and drag from a connection point on one block, to a connection point on another block.

For more information about working with logic blocks, see Logic Blocks.

Adding Devices

Several Ross Video devices and other DashBoard-enabled devices expose functions and parameters you can use in your CustomPanels. The functions and parameters are designed to enable you to monitor and control the devices.

The Devices and Parameters tree lists API functions and parameters associated with devices and panel parameters.You can add devices from the Basic Tree, or add Ross Video device type templates and connect them to real devices later.

 

To add a device to the Devices and Parameters tree:

In the Devices and Parameters panel, click the green + icon, select a device type, and then specify properties of the device.

You can add devices from the DashBoard Basic Tree, or add a device template of one of the following types: Acuity, CamBot, PBus, VDCP, and XPression.

Tip: You can also create an entirely new device type. For more information, see Creating a New Device Type in Visual Logic.

Adding Panel Parameters

Panel parameters are listed in the Devices and Parameters tree. Expand the Panel Parameters folder to reveal a list of the parameters available in the CustomPanel.

You can drag parameters into the workspace to use them in your ogScript code. Parameter values can be routed to other logic blocks for logical operations.

For more information about parameters, see Parameters and Data Sources.

Adding Local Variables

You can create local variables. Some logic blocks (such as the for loop block) also create local variables.

Local variables can be dragged from the Local Variables panel into the Visual Logic workspace.

The scope of local variables is restricted to the current function.

To create a local variable:

In the Local Variables panel, click the green + icon, select a variable type, and then specify properties of the variable.

Local variable types include Boolean, Date, Generic Variable, Number, and String.

Adding Logical Controls and Math Operations

The Control folder contains logic blocks that perform logical and mathematical operations.

You can use these logic blocks to test conditions (if, switch), set up loops (for, while), parse and manipulate string data, and perform mathematical calculations.

Creating New Functions

From the Control and APIs panel, you can create a new function that is available within the current segment of ogScript code.

Functions created in the Control and APIs panel appear in a folder named local functions. They are available only within the current segment of ogScript code. For information about creating functions that are available throughout the current CustomPanel (internal APIs) or available to other panels (external APIs), see Creating Internal and External APIs.

By default, there are no tabs in the workspace. If you add a new function, your existing work appears on the Main tab, and the new function appears on a tab named after the function. Each additional function appears on a separate tab.

To create a new function, click the click the green + icon, click Add Function, specify the properties of the function (Function Name, Has Return value, # of Arguments), and then click Ok.

Using Functions

In the Control and APIs folder, the following function folders contain functions you can drag into the workspace:

ogScript — Contains functions developed by Ross Video to interact with DashBoard-enabled devices. ogScript is a subset of JavaScript, with PanelBuilder-specific functions added.

For detailed reference information about ogScript functions and their parameters, see the DashBoard CustomPanel Development Guide (8351DR-007).

API Functions — Contains functions imported from an external API.

The API Functions folder is visible only if one or more external APIs have been added to the CustomPanel.

For more information, see Importing External APIs from Saved Files.

API Objects — Contains objects imported from an external API.

The API Objects folder is visible only if one or more external APIs have been added to the CustomPanel.

For more information, see Importing External APIs from Saved Files.

local functions — Contains functions that are available only within the current segment of ogScript code.

The local functions folder is visible only if the current segment of ogScript code contains one or more function definitions.

For more information, see Creating New Functions.