# Mappview widget

**URL:** <https://community.br-automation.com/t/mappview-widget/2251>\
**Category:** HMI & Visualization\
**Tags:** mapp-view\
**Created:** [February 17, 2024, 5:02pm UTC](https://community.br-automation.com/t/mappview-widget/2251 "2024-02-17T17:02:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [February 17, 2024, 5:02pm UTC](https://community.br-automation.com/t/mappview-widget/2251/1 "2024-02-17T17:02:29Z")

</div>

How do you change the color of a line widget when OPC-UA value is changed.

---

<div class="post-metadata">

**Author:** ![Juul\_Ermens](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Juul\_Ermens](https://community.br-automation.com/u/Juul_Ermens)\
**Post date:** [February 17, 2024, 8:33pm UTC](https://community.br-automation.com/t/mappview-widget/2251/2 "2024-02-17T20:33:54Z")

</div>

It is not possible to bind something to the color, but it is possible to bind something to a style.

You can create multiple styles for the line widget and then use a binding to switch between the styles. The binding must contain a string of the style ID.

Note that it is also possible to change styles in eventbindings.

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [February 18, 2024, 4:27pm UTC](https://community.br-automation.com/t/mappview-widget/2251/3 "2024-02-18T16:27:50Z")

</div>

if you do not want to use solution with style changing, you can layer more lines with different colors and control visibility using property visible and binding OPCUA value to it.

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [February 22, 2024, 11:03am UTC](https://community.br-automation.com/t/mappview-widget/2251/4 "2024-02-22T11:03:20Z")

</div>

I still couldn’t get the color change. Only the lineCap changes. That’s the only style property that I could change.

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [February 22, 2024, 11:04am UTC](https://community.br-automation.com/t/mappview-widget/2251/5 "2024-02-22T11:04:50Z")

</div>

Is there a tutorial that explains clearly on to change styles in eventbindings

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [February 22, 2024, 11:45am UTC](https://community.br-automation.com/t/mappview-widget/2251/6 "2024-02-22T11:45:13Z")

</div>

You have to define linecolor in the style e.g.

 ![style](https://europe1.discourse-cdn.com/brcommunity/original/2X/5/5149ee3f82ff73317957697e5bb19da526ea73aa.jpeg)  
And then use event binding, value change and use condition to select proper one.  
 ![EventBinding](https://europe1.discourse-cdn.com/brcommunity/original/2X/a/ac2a0e1c14d3a6b63e67bc0d1320ea9accdce7cb.jpeg)

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [February 23, 2024, 9:54pm UTC](https://community.br-automation.com/t/mappview-widget/2251/7 "2024-02-23T21:54:02Z")

</div>

Just a side note. The Style will only change correctly as long as the widget you are trying to change doesn’t have any local style edits.

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [February 27, 2024, 10:36pm UTC](https://community.br-automation.com/t/mappview-widget/2251/8 "2024-02-27T22:36:18Z")

</div>

Can you explain more on local style edit. I didn’t get it.

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [February 27, 2024, 11:33pm UTC](https://community.br-automation.com/t/mappview-widget/2251/9 "2024-02-27T23:33:18Z")

</div>

Sure I’ll try my best with a quick example.

![2024-02-27_17-18-02](https://europe1.discourse-cdn.com/brcommunity/original/2X/c/ce823dcc1c6fb86b69da187233839d245bbdddc0.gif)

There are 3 buttons

- left button is style “default” but with style changes only for this widget.  
Local changes are always **BOLD** in the editor

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/7/7088ba7d44fc51f462882db4b69070cf27bf02b2.png)

- the right button is style “transparent” without any local changes

With the ToggleSwitch the style of the center button is switched between default and transparent but you can see that center and right button styles are not the same when transparent should be active. That’s is because the button we are trying to change style on has a local modification that the style change action doesn’t overwrite.

With all local style changes removed the style change works correctly.

![2024-02-27_17-31-28](https://europe1.discourse-cdn.com/brcommunity/original/2X/5/599e51288f109e0f1d3c09e80ece7ef092f87928.gif)

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [February 28, 2024, 10:06pm UTC](https://community.br-automation.com/t/mappview-widget/2251/10 "2024-02-28T22:06:00Z")

</div>

How do you remove local style changes. In the properties window of the widget? Can you please explain on this.

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [February 28, 2024, 10:41pm UTC](https://community.br-automation.com/t/mappview-widget/2251/11 "2024-02-28T22:41:34Z")

</div>

Sure, just right click the appearance property you want to reset/remove and a Reset button will appear. Click that and this property is reset to default from the selected style.

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/8/873ef98713ae621bd6739a5d15aa58f3c1400bba.png)

You could also do it with a text editor if you have many widgets or many local modifications but that can get you into trouble quickly if you aren’t exactly sure what you need to remove to reset the local style properties.

And as side note. Make sure the “Hide Style properties” button isn’t enabled since that hides all appearance properties which can be very nice to declutter the property window.

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/2/2971ea552cfa75838801439733a8855b1261b79c.png)

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [March 2, 2024, 4:09pm UTC](https://community.br-automation.com/t/mappview-widget/2251/12 "2024-03-02T16:09:27Z")

</div>

I tried it but couldn’t change the style. It is always the default color(orange) that comes. The bar color is reset. I used the Progressbar widget.

![A screenshot of a computer Description automatically generated](https://europe1.discourse-cdn.com/brcommunity/original/2X/b/bdf95fc73d286c58ea8d758778c3a557580dacc5.png)

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [March 4, 2024, 2:48pm UTC](https://community.br-automation.com/t/mappview-widget/2251/13 "2024-03-04T14:48:48Z")

</div>

@Joslet_Sebastian Sebastian

Did you create a new style for the ProcessBar under your active theme? If you have multiple themes in you project you have to have the same style ID in all themes. They can have different values but the ID needs to be the same otherwise your style switching works in one but not the other.

If you haven’t, please look for the ProgressBar style entry under Default.styles.

Copy the default style, rename it, add the **barColor** property and define the color you like for it.  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/1796913f1c0f8b467f46325db8e4d6cc3c931ef1.png)

In your EventBinding you use the SetStyle method to change the style for the ProgressBar to the new style you just added, in my case “red”. If you use the graphical editor the drop down provides you with the available style for this widget.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/9/9a1878f276234cb9a62f6fdecfa2f7799c376b29.png)

In text format it looks like this. In my case the default style is set whenever the ToggleSwitch is false.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/7/717b8509baa06e2f83525555405b7d1e83d368ed.png)

![2024-03-04_08-26-02](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/6b976696541c00d12facb0d7a0a777ada65123db.gif)

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [March 6, 2024, 2:38am UTC](https://community.br-automation.com/t/mappview-widget/2251/14 "2024-03-06T02:38:43Z")

</div>

Marcel,

I tried again and couldn’t get the style changing. Can you sent me a snap shot of the properties window of both widgets. Also a snapshot of visualizat.vis. Not sure where I am getting wrong on this.

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [March 6, 2024, 1:48pm UTC](https://community.br-automation.com/t/mappview-widget/2251/15 "2024-03-06T13:48:26Z")

</div>

Sebastian @Joslet_Sebastian

I do you one better!  
I have attached a zip file the you can either import directly into an AS project (new one preferred) or unzip and bring in the files individually.

In summary this is really just the added red style for the ProgressBar under Default.styles,

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/176423ed61445871a1616d967d300f2b8ec0459a.png)

the ProgressBar and ToggleSwitch widgets in a content,

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/8/805358fad1b9e67742fe7dccf098fc86a92d3a8a.png)

and the EventBinding with the SetStyle action.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/61829eded93df0a82e23b6b98a48e10b39509032.png)

In the Vis file you will see the Page, the EventBinding and the Theme referenced  
Let me/us know if this does the trick for you!

[StyleChangeSample.zip](https://community.br-automation.com/uploads/short-url/60Y9aKFQrwbgHp8BitLL81I1ex3.zip) (28.7 KB)

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [March 12, 2024, 1:10pm UTC](https://community.br-automation.com/t/mappview-widget/2251/16 "2024-03-12T13:10:00Z")

</div>

Marcel,

It works now! Thanks for your help. I have another question for you, can a widget line drawn as seen below

![image001.png](https://europe1.discourse-cdn.com/brcommunity/original/2X/4/404abc17b8ad8fefe5920b37d74b442ebee8ac58.png)

(Attachment Visualization vis\_0 - Google Chrome 2024-03-12 08-22-24.mp4 is missing)

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [March 12, 2024, 1:25pm UTC](https://community.br-automation.com/t/mappview-widget/2251/17 "2024-03-12T13:25:49Z")

</div>

Marcel,

It works now! Thanks for your help. I have another question for you, can a widget line drawn as seen below

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [March 12, 2024, 1:29pm UTC](https://community.br-automation.com/t/mappview-widget/2251/18 "2024-03-12T13:29:01Z")

</div>

Is the line static or drawn interactively? Unfortunately the video you attached is missing. Maybe try to upload the video again?

---

<div class="post-metadata">

**Author:** ![Joslet\_Sebastian](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Joslet\_Sebastian](https://community.br-automation.com/u/Joslet_Sebastian)\
**Post date:** [March 12, 2024, 2:47pm UTC](https://community.br-automation.com/t/mappview-widget/2251/19 "2024-03-12T14:47:10Z")

</div>

It will be static but will change color depending on motor switching. But I need to draw these shapes to represent motors feeders supplying material to a hopper.

---

<div class="post-metadata">

**Author:** ![marcel.voigt](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcel.voigt/32/97_2.png) [@marcel.voigt](https://community.br-automation.com/u/marcel.voigt)\
**Post date:** [March 12, 2024, 3:25pm UTC](https://community.br-automation.com/t/mappview-widget/2251/20 "2024-03-12T15:25:29Z")

</div>

I see two options.

- depending on how many states you have, draw them as SVGs and use the ImageList widget ([B&R Online Help](https://help.br-automation.com/#/en/4/visualization%2Fmappview%2Fwidgets%2Fimage%2Fimagelist%2Fimagelist.html)) to switch between them while also being able to change the color which may reduce the number of images you need.

- use the Paper widget ([B&R Online Help](https://help.br-automation.com/#/en/4/visualization%2Fmappview%2Fwidgets%2Fdrawing%2Fpaper%2Fpaper.html)) in order to draw the lines on the fly in PLC code using the svgContent property. That would require the premium license and PLC string handling code, in addition it’s a class C widget.

When you draw SVG images make sure the color is “Unset” so it can be changed during runtime.

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/9/9296fca18c44c08acc79091a97cf383120280144.png)

You can check if the images changes colors correctly in the offline editor by changing the imageColor on the image you would like to use. Remember to set the default color before trying to attempt changing the color online with an action.

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/17f23808ddbff10f2828618c344c0c99887cfcd9.png)

If the color doesn’t change the SVG contains a fixed fill color and you need to modify/remove it.

[Next page](https://community.br-automation.com/t/mappview-widget/2251.md?page=2)
