Blinking Rectangle

Hi, I have a dropdown menu with various values and I would like different rectangles to blink on a map depending on the value that has been chosen on the dropdown box. I'm not entirely sure how I would code this in scripting. Any help would be appreciated!

Step 1: Tag your question as vision or perspective!

2 Likes

The correct answer for a dropdown in the Vision module will be completely different from the correct answer for a dropdown in the Perspective module. For this reason, you will have to let us know which module you are developing with in order to get the appropriate answer.

1 Like

I'm new to Ignition so I'm unsure what this means, but maybe this helps? For reference, I want the various orange rectangles to blink depending on the number selected.

thats in image? i dont think you can just magically do that on an image
ah or is it the "rectangles" above the image?

I want the Rectangles 1-7 to blink, not the image files.

This is Vision, and the rectangles are path based Vision shapes with a background property that can be made to blink. Does the blinking needs to be synchronous?

Not synchronous. I want all the rectangles to be hidden and ONLY show when a number is selected from the drop down menu

Ignition has two HMI / user interface modules.

  • One is called "Vision" and creates stand-alone Java-based clients that are installed on a HMI PC.
  • The other is "Perspective" and is web based. A web browser is the client and the Ignition gateway is the web server.
2 Likes

If I'm understanding the problem right, you'll basically just want to bind your "visible" property on each rectangle in a way that returns "false" unless the corresponding label(s) is selected on your dropdown menu.

You could add a custom property on each rectangle that matches the location name (like each rectangle would have a custom property called "Location", and this could equal "209" for one of those rectangles). Then make "visible" true when the selected label of the dropdown is equal to the custom Location property.

This all depends on the current configuration of those rectangles and how scalable you want this system to be.

2 Likes

Out of curiosity, what version of Ignition is this?

This is version 7.9

Ahh I see, so will this script be written for each individual rectangle? My initial through process was to write one long script that will just call upon each rectangle by name. Also how do I make it blink? Where does the timer component come into play?

Yes -- you could write a script on the propertyChange event of the dropdown menu that looks at the newly selected value, checks all of the rectangles, and sets visibility to true wherever it finds one that matches, but that's not something I would do. I try to avoid property change scripts because I have found them to be not 100% reliable, plus this will introduce some amount of lag for the user whenever they change the dropdown menu's selected value. The script will have to execute every time and iterate through the rectangles.

One binding (not necessarily a script -- this could be an expression or property binding in your case) for each rectangle would be preferable in my opinion. That way it's more like the rectangles are "pulling" information from the dropdown menu on an as-needed basis, rather than the dropdown menu "pushing" information out to everything at every change.

For the blinking, you would just need 1 timer component and 1 more set of bindings on your rectangles. For example, you could bind the fill paint property (on each rectangle) to the timer's value in a way that sets the color to full transparent and back to its semi-transparent yellow color repeatedly as the timer value updates. Maybe the timer's bound is just set to 1, so it repeatedly flips from 0 to 1 (corresponding to full-transparent and translucent yellow, respectively) on a schedule based on your delay value (default delay time is 1 second -- you may want your blinking to be a little faster than that, etc...). To save on performance you could ensure the timer is only running (i.e. its property "Running?" is set to "true") when there is at least 1 rectangle visible on the screen.

I would simply do this expression on each rectangle Visible Property
{Root Container.Dropdown.selectedValue}=209
using a different number for each rectangle.

1 Like

That's a lot of expressions. Perhaps the rectangle should be templatized and possibly rendered with a repeater, so any future changes that are needed can be made one place. This would probably reduce development time as well.

3 Likes

Yes, a Template would make thing even easier