How to Make Widgets Blink in MappView Using Session Timers

Hey Everyone!

This is piggybacking on Jan’s excellent post about Status Indicators, so check out that page if you haven’t already.

Summary:

BlinkGif

This is a way to make widgets change styles at the rate of a Session Timer, causing them to blink. Since it is completely done using MappView features, it does not require code to be written in a task.

Create the Session Timer:
In the Configuration View in Automation Studio, open the mapp View Configuration file. In the Session Timer section, give your timer a name and a default interval. Make sure the Timer Mode is set to “repetitive”.

Create the Styles:
In this example, I want to use an ellipse as a blinking status indicator with the following state:

  • State0 (default) = Gray
  • State1 = Red
  • State2 = Green

I create styles with generic names. Using generic names, I will be able to apply the blinking to other widget types if I want.

Create the Session Variables:
I create four session variables: 3 for the blink states, which are set to the names of their corresponding styles, and 1 for BlinkStateSelector, which I will use to select the current style for the widget.

Bind the Style List:
I create a list binding for the style property of the ellipse I want to blink. I choose the BlinkStateSelector session variable I created for the Selector, and I add the BlinkState session variables to the binding list, with their keys matching their state number.

Create the Event Bindings:
The event binding file is split into 3 parts:

Step 1: I start the system timer as soon as the content is loaded. This way, I can use the same system timer for multiple widgets.

image

Step 2: I create an event binding for when the blink timer has elapsed. I create an operand for the BlinkStateSelector variables, so that I can read its value. If the BlinkStateSelector = 1, I set its value to 2; similarly, if it equals 2 when the timer has elapsed, I set it to 1.

image

Step 3: I create an event binding for the PLC variable I want to monitor, exposed over OPCUA. In this case, I am monitoring a variable called AlarmActive for any change. If its value turns false, I set the BlinkStateSelector to 0 (the default blink state). If its value turns true, I set the BlinkStateSelector to 1, and the event binding from Step 2 takes over.

image

There are several ways to get widgets to blink, but with this one, you can use the same timer and selector variable across multiple widgets.

BlinkGif

Happy Automating! :robot:

10 Likes

@blake.eby you are awesome :slight_smile:

2 Likes

@blake.eby I challenge you to make that into a nice compound widget :wink:, great post!

4 Likes