Article translated with the assistance of AI tools. Images and parts of the content will still be reviewed.
Part 8 of this tutorial aims to guide the user on how to proceed if screen access restriction is needed and how to configure the visualization to display a WEB page.
1. Creating POU and GVL
After creating the users (in Part 4 - Login Management of this tutorial), follow these steps:
• Create a POU in ST :
NOTE: Don’t forget to call your POU in UserPrg so that it is executed.
• Create a list of global variables (GVL):
Declare the following variables in the GVL.
strVisu: STRING := `Visualization`;
bSetURL : BOOL := 1; // Show Web Page
bGoBack : BOOL; //Go back web page
bGoForward : BOOL; //Go forward web page
2. Logic to change screen and check logged-in user
At first, it is necessary to enable the use of the current visualization variables. To do this, go to VisualizationManager and under the Settings tab, enable the checkbox for Use CurrentVisu variable.
After enabling the previous feature, go to the POU and enter the instructions below. Where VisuElemsWinControls.CurrentUserName returns the name of the logged-in user and VisuElems.CurrentVisu contains the name of the screen that is open; it is possible only to read and write to the CurrentVisu variable.
Once this procedure is done, just log in and the script will direct you to the desired page. In this case, if the user is (admin) the Visualization_1 screen will be displayed.
3. Configuring Web Page
First, place the BrowserControl object in your application and set its dimensions as desired.
With the object on the screen, double-click it to access its properties. In the Control Variables tab, we will link the variables created earlier and the desired URL.
In URL (inside single quotes since it is a string), type the URL of the desired page, or link a string-type variable that contains the desired URL.
In the SHOW field, a bool-type variable is also linked that activates the visibility of the WEB page; it is necessary to have an upward border so that the screen is displayed.
The BACK and FORWARD parameters serve to go back and forward the page; to use this feature, it is necessary to place two buttons on the screen and in their properties (Input configuration) under the (Toggle) sub-tab and in the (Variable) parameter link your bool variable. This configuration can be seen in the image below.
Configuration image of the BACK button
Configuration image of the FORWARD button
4. Conclusion
With this eighth part, we conclude the tutorial on how to use the WEB visualization function of your NX3005 or XP340 within MasterTool IEC XE (WebServer). You have learned from the basics to the advanced on how to create a functional and elegant visualization for various different applications. Below you can download the project file to import on your computer.
Feel free to ask us any questions through the send inquiry button below and we hope you have made good use of this tutorial.
See also:
Part 3 - Creating Interactions with Objects
Comments
0 comments
Please sign in to leave a comment.