MappView API?

Hello,

I’m a long-time user of VC4 and am just starting to explore mappView as I see that transition happening the future for our equipment. There’s a lot of quirks I’m already not a fan of and features that appear missing in comparison to VC4.

Are there any libraries that I can use to manipulate a mappview visualization like I can a VC4 visualization?

Is there any way to know what page the user is on programmatically? In VC4 we use the current page as an index in a switch so that only relevant code to the current page is run. I can’t find that functionality anywhere in the mappview visualization help.

How do I link localized texts to widgets like buttons on the display? None of the texts I add appear in the list to link for the binding.

Thank you in advance,
Kyle

Hello Kyle, one thing we need to keep in mind is that mapp View is a different visualization concept and uses different technology, and we should therefore not try to recreate our VC4 visualizations 1:1 in mapp View. mapp View offers unique widgets and other ways of implementing your content. I often see customers who are converting their VC4 HMI with as few changes as possible, not taking advantage of mapp View, but also not taking into consideration/not being aware of some potential limitations.

Do you have an use case in mind, for what you would like to manipulate through libraries? I am not aware of any such library, but I have never felt like I need one. There is however a tool for developing your own widgets, if you’re good with HTML/JavaScript.

Yes, it is possible to see which page is active or which content was loaded. For example, when a content is loaded you get an event, and this event can be stored in a so called session variable (i.e. a variable which only exists “within the visualization”). That’s how I usually solve it. You can see the active page ID like this: AS Help. But I generally try to minimize PLC code for my HMI, and keep as much of it as possible in the HMI itself.

As for the texts, maybe you are missing the “IAT” in the namespace? You can always open the “mapp View highlights” project if you need some inspiration, or if you are unsure how to best solve some things. You can find it in the “Samples” folder within your AS installation.

2 Likes

Hi Kyle,

There’s definitely a learning curve when moving to mappview from VC4. Features may appear to be missing but many of them are implemented differently.
If you’re looking for some premade mappview libraries or widgets you can find some cool stuff on the B&R github GitHub - br-automation-com/awesome-B-R: A curated list of awesome B&R frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff..

Now to answer your questions.
There is a system variable called currentPageId as seen in the Help at 7b51baa7-b449-4246-9a5d-d983f8046039.
You can bind a string variable to it, then whatever page you’re on, the string will be the PageID.

In order to make a text available for binding, you need to create a .tmx in the Logical view, I would recommend under mappview > Resources > Texts. Then add a .textconfig file in the TextSystem folder in the Configuration view. In that .textconfig file make sure the .tmx file is listed under the ‘Tmx files for Target’ section.

2 Likes

Hi Oliver,

I understand they are 2 vastly different technologies, but it is disappointing to lose functionality and increase difficulty and development time. I have 40+ projects currently using VC4 that have been migrated forward since we used the PP420s over a decade ago and any new development in that time has all been done in VC4.

The functionality I’d like with some kind of mappview library would be to be able to do things like change loaded content from code or current pages, possibly control dialog boxes, and change screen brightness. These are all things I’m currently doing in VC4 with ease. With VC4 and even PanelWare, I’ve always had the majority of the code for the HMI running on the PLC, mostly because there are certain pages I only want to show the operator under certain conditions, whether it be based on machine mode or I/O point status.

I used IAT in my namespace and the text appeared, I didn’t realize the namespace had to include that. I’ll look through the mappview highlights project as you suggested.

Thanks!

1 Like

Hi David,

Thank you for the link to the github, I’ll definitely be using this as a resource moving forward.

As for that binding, I’m guessing you have to add that to every page? Is there a way to do this with loaded content as well? My local B&R office advised me that it’s more efficient to have a single page and load different content into it when needed rather than full page changes.

Thanks!

Hello,

The binding I showed you only needs to be made once and it will always be populated with the current PageID.
If you plan to only use one page however then you will need keep track of the loaded content either through code or with an event/action binding.
There is an event triggered when a content is loaded, the ID of the content can be retrieved by the event handler and as an action can be assigned to a string variable. The Help provides an example of this here B&R Online Help.

I understand it can feel that way, especially when you are just starting out and have to get used to a completely different workflow. But I would say most things that were possible in VC4 are now possible in mapp View, and some things that are missing are being implemented, like taking screenshots. Also, some of the more tedious stuff in VC4 is now easy to implement in mapp View, like MessageBoxes and enabling/hiding widgets based on user level, while I do agree some tasks were easier to do in VC4. Let’s not forget that it also enables modern tech which was previously not possible at all, like multi-touch control, dragging widgets, dynamic animated SVGs and more.

You can change the content by using the action (event binding) “LoadContentInArea”, and this can be controlled through an OPC UA variable or be dynamically set from the HMI etc. No library is required for that. Not sure what you mean exactly by controlling dialog boxes, but those are just contents and they can be quite dynamic, for example you can create a sequence of contents that should be displayed in your dialog with events and actions, load dynamic contents into the dialogs, or use the FlexBox widget to have dynamic content/widgets. If you want to make sure that some pages are not accessible based on I/O points you could hide the navigation button (datapoint “visible”) and connect it to a OPC UA variable.

Regards,
Oliver