You're currently browsing the Ignition 8.0 docs. Click here to view the latest docs.


In Perspective, events and actions are some of the fundamental building blocks of project functionality. Actions give you the ability to respond to specific user inputs (such as mouse, keyboard, and touch inputs), as well as broad session events (like the beginning and end of the session) in many different ways. Thus, actions are a response to events.

Example uses for events and actions include:

  • Navigating to a new page when the user presses a button.
  • Opening a popup containing details on a specific PLC when a user double-clicks on it in a diagram.
  • Logging the user out of the session when they press Ctrl + L on the keyboard.
  • Scanning a barcode from a mobile device, and sending it to the Gateway.

In this section, we'll cover the basics on how to configure actions and events to suit your project's needs. 

Configure Events and Actions

To configure an event and action on a component:

  1. Select the component.
  2. Right click on the component, and select Configure Events



  3. Choose an event from the left hand side. Note that you can configure actions for as many events as you'd like, but you'll need to configure the actions separately for each one.




  4. Next choose one or more actions to associate with the event, by clicking the  Add   icon.  Descriptions of the options for each component action are described in the sections on this page.
  5. Configure the actions as you want then click OK.

On this page ...

IULocgo


Events and Actions


Perspective Events

Perspective offers a wide range of possible events, but in this section we'll highlight a few common ones. You can find details on all configurable events at Perspective Event Types Reference.

Event TypeExample Event

Component Event

Many components have their own events that are related directly to the functionality of the component. For a full list of components with configurable component events, see Perspective Event Types Reference.

System Event

  • onStartup events occur when the View or component is loaded into the session. For example, if you configure an onStartup event on a component, the event will occur when the view it is on is opened.
  • onShutdown events occur when the View or component is removed from the session. Typically this will occur when you navigate away from the View containing the component, or if the session times out.

Mouse Event

  • onClick events occur when the user clicks on any of their mouse's buttons, while the cursor is hovered over the component.
  • onContextMenu events occur when the user clicks the mouse button associated with a context menu (typically the right mouse button, on a two-button mouse).
  • onMouseOver events occur when the mouse pointer enters the component's borders. 

Keyboard Event

  • onKeyUp events occur when a key on the keyboard is released, while the component is focused.
  • onKeyPress events will be run repeatedly, while a key is held down and the component is focused.
Touch Event
  • onTouchStart Fired when the user has touched the surface of a touch capable device.  

Wheel Event

  • onWheel events occur when a user moves the scroll wheel while hovered over the component.


Action Types

Each Event can have actions assigned to them, and each Action has some specific purpose. Each event can have any number of actions, and different types of actions can do different things. 

If you want to delete an action, use the Delete  icon.

Each Action is called in order from top to bottom. To control this execution order, you can reorder the list of Actions using the Up Arrow   and Down Arrow   icons next to the list. However, Actions are not executed synchronously: sequential actions do not wait for any prior Actions to finish executing before running. Thus, if Action 1 is a long-running script, while Action 2 is quick to finish, it is possible that Action 2 will finish before Action 1.

Shared Action Options

The bottom of each action lists a set of options. The options listed in the table below are shared across all action types. 

Enabled

Specifies whether the action should be used or ignored.

Prevent Default

The following feature is new in Ignition version 8.0.15
Click here to check out the other new features

Prevents the browser's default behavior from occurring. Useful when you want to prevent the browser's built-in right-click menu from showing. 

Stop Propagation

The following feature is new in Ignition version 8.0.15
Click here to check out the other new features

Prevents events from higher up in the component hierarchy from triggering when the selected event triggers.

Accelerometer Action

Retrieves accelerometer data from the device's accelerometer (a common feature on smartphones). This is a Native App Action, designed to help in gathering data from a mobile device. Each action needs to be configured in two parts:

  1. The action is run on a mobile device, indicating that a type of data should begin to be gathered.
  2. As the data is gathered, or once it's finished being gathered, it is sent to the Gateway to be handled by the corresponding Session Event.

This action is designed specifically for the Ignition Perspective App for Android and iOS devices. If it is run in a browser session, it will be ignored.

Action SettingDescription
Continuous

Begins recording accelerometer data, which repeatedly updates the accelerometer object in the current session's Session Properties.

  • Sample Rate indicates how often the accelerometer object should be updated.
  • Context provides the opportunity to pass a custom object through to the Accelerometer Data Received Session Event. Note that a session object is already provided to that event script.
Batch

Records accelerometer data at a specified interval for a specified rate, then sends the accumulated data to the Gateway, to be handled by the Accelerometer Data Received Session Event.

  • Sample Rate indicates how often a reading should be made.
  • Duration specifies for how long data should be logged.
  • Context provides the opportunity to pass a custom object through to the Accelerometer Data Received Session Event. Note that a session object is already provided to that event script.
OffTurns off accelerometer data recording.

Alter Logging Action

Perspective sessions log their session activity and errors to the logs of the browser they run in. Alter Logging allows us to change how verbose this logging is. This is useful for session debugging.

Action SettingDescription
Remote Logging Enabled

Indicates whether the browser logs should also be sent to the Gateway to log in the Gateway logs. Note that for all messages to be visible, the Perpective.Client logger must be set to the same logging level as the level indicated in this action.

Set Logging Level

Dictates how verbose the session's logging should be. A logging level of all (or trace) shows all possible records, while a level of off shows none. Options are:

  • all
  • trace
  • debug
  • info
  • warn
  • error
  • fatal
  • off

Dock Action

Allows you to open or close a docked view. The view must be configured as docked in the Page Configuration section of the designer, and must be configured with a dock ID. The dock ID can be whatever you'd like. We'll need it here in order to run the action.

Action SettingDescription
Dock Action

There are three types of dock actions:

  • Open: Opens the docked view.
  • Close: Closes the docked view.
  • Toggle: Toggles the state of the docked view, so opens the view if it currently closed, or closes it when it is currently open.
IdentifierThe ID of the docked view. Dock ID values can be set when you configure a view as docked.
ParametersParameters that can be passed into the docked view. The name of the parameters must match the name of the view parameters that are already set up.

Fullscreen Action

The following feature is new in Ignition version 8.0.10
Click here to check out the other new features
Enters full screen mode.  Requesting to enter full screen mode only works with events that originate from user interactions. Some browsers may not support full screen requests.

Action SettingDescription
EnterEnters full screen mode.
ExitExits full screen mode.
ToggleChanges the Session's browser to whichever mode it is not currently in.
ViewEnters full screen mode on a targeted view.
PageEnters full screen mode on a targeted page.

Login and Logout Actions

Logs the current user in or out of the session. The only action property is the Enabled option which specifies whether the action should be used or ignored. 

Action SettingDescription
Ask the IdP to re-authenticate users

Determines how re-authentication requests sent to the Identity Provider will be handled.  Note that Identity Providers can choose to ignore re-authentication requests, defaulting to their own behavior. Options are as follows:

  • Project - Use the re-authentication setting located in the General category of Project Properties.
  • Enable - Prompt the user to provide their credentials, even if they're already logged into the session.
  • Disable - When selected, the user will not have to provide their credentials if they're already logged in. 

Navigation Action

The Navigation action allows you to navigate to different views, pages, or URLs from an event. The Navigation action has several modes. Each mode allows for a different type of navigation and different options. The following table lists the types of navigation:

TypeDescription
Page

Navigates to a separate page.

TypeDescription
Set PageA string denoting the page URL of the target page.

Open in new tab

Specifies whether the newly opened page should replace the current page, or open in a new browser tab.
View

Replaces the current main View with a new main View.

TypeDescription
Select ViewThe path to the view that should be used.
Parameters
A set of parameters to pass to the view. Add or remove parameters with the Add icon and Delete  icon. In the Value field for a given parameter, you can pass in a path to a property value using the Parameter icon
Url

Navigates to an external web address. 

TypeDescription

Enter Url

The URL that the action should navigate to. Example: https://inductiveautomation.com/
Open in new tab:Specifies whether the newly opened page should replace the current page, or open in a new browser tab.

Popup Action

Opens a view as a popup, or closes an existing popup.

Action SettingDescription
Popup Action
  • Open: Opens a view as a popup.
  • Close: Closes an existing popup.
  • Toggle: Opens a popup if it isn't open, and closes the popup if it is open.
Select View

The path to the view that should appear as a popup.

Parameters

A set of parameters to pass to the view. Add or remove parameters with the Add icon and Delete icon. In the Value field for a given parameter, you can pass in a path to a property value using the Parameter icon.

IdentifierA string that specifies a unique popup identity. If you want to close an open popup from a popup action, you'll need to supply the identifier that was used to open it.

Title

A string of text to display in the titlebar. If omitted, no titlebar is used.
Show close buttonA boolean indicating if a Close Icon should be displayed on the popup.

Draggable

A boolean indicating if the popup should be able to be dragged to new positions.

Resizable

A boolean indicating if the popup is allowed to be resized.

Modal

A boolean indicating if the popup should be modal, meaning it is the only view the user can interact with while open.

Background dismissible

A boolean indicating if the popup can be dismissed by clicking outside of it. This setting is only applied if the modal option is enabled. If omitted, defaults to false.

Position Exact

The following feature is new in Ignition version 8.0.6
Click here to check out the other new features

Exact Positioning controls where in the session the popup should appear, and how large it should be. If no specifications are given, the popup will open centered at its default size.

  • Top, Left, Bottom, and Right control how far the popup should be offset from each margin of the session.
  • Width and Height specify how large the popup should appear.


Position Relative

The following feature is new in Ignition version 8.0.6
Click here to check out the other new features

Relative Positioning enables the popup to be positioned based off of the mouse cursor position when used with a Mouse Event. The Circle icon in the center represents the mouse location. The arrows icons represent the location the popup will appear in relation to the user's mouse cursor. Click on an arrow to position the popup window.

Refresh Action

Reloads the current browser tab.

Scan Barcode Action

Allows the user to scan a single barcode on their mobile device, which is then sent to the Gateway and handled by the Barcode Scanned Session Event

This action is designed specifically for the Ignition Perspective App for Android and iOS devices. If it is run in a browser session, it will be ignored.

This is a Native App Action, designed to help in gathering data from a mobile device. Each action needs to be configured in two parts:

  1. The action is run on a mobile device, indicating that a type of data should begin to be gathered.
  2. As the data is gathered, or once it's finished being gathered, it is sent to the Gateway to be handled by the corresponding Session Event.

Action SettingDescription
Barcode TypeIndicates the format of the barcode to be scanned. Any can be used to catch all barcodes.
ContextProvides the opportunity to pass a custom object through to the Barcode Scanned Session Event. Note that a session object is already provided to that event script.


Scan Ndef NFC Action

Allows the Perspective app to catch any scans by the phone using the NFC data exchange format (Ndef), which is then sent to the Gateway and handled by the NFC Ndef Scanned Session Event. This suppresses any default behavior of the phone in catching the scan. 

This action is designed specifically for the Ignition Perspective App for Android and iOS devices. If it is run in a browser session, it will be ignored.

Action PropertyDescription
Single ModeListens for a single NDEF scan to send.
Continuous Mode Listens indefinitely for NDEF scans, which are sent to the gateway as they are received.
Off ModeTurns off listening for NDEF scans.

Script Action

Write a script that happens on the event specified. See Perspective Component Methods and system.perspective Functions for more details on how to configure script actions.

The following feature is new in Ignition version 8.0.5
Click here to check out the other new features
Script actions contain a built-in "event" object, that further contains values pertaining to the underlying event. As of 8.0.5 these values and descriptions are displayed in the docstring.

Theme Action

Changes the theme for the session.

Action SettingDescription
Select ThemeTheme that will be used, for example dark, light, light-cool etc. Dropdown list of all available themes.





  • No labels