Displaying websites in a visualization
Requirement: A visualization open in a CODESYS project. The “Visualization Toolbox” and “Properties” views of the visualization are also open.
-
Drag the “Web Browser” element from “Special Controls” to the visualization editor.
-
Select the element in the editor.
In the “Properties” view, the element properties are listed for the “Web Browser” element.
-
In the “Position” property, specify the size (in pixels) for the “Width” and the “Height” (example:
600). -
In “Control variables URL”, specify the URL for the website (example:
'http://de.wikipedia.org'). You can also specify a variable here (STRINGorWSTRING) where the URL is assigned in the project. -
In “Control variables Display”, specify a Boolean variable (example:
bSetURL).If the variable
bSetURLhas the valueTRUE, then the website'http://en.wikipedia.org'is displayed at runtime.
Configuring the buttons for forward and back navigation of the website
Requirement: The “Web Browser” element of your visualization is configured as described above.
-
In a POU, declare both Boolean variables
bGoBackandbGoForward. -
In the visualization editor, click the “Web browser”.
-
For the property “Control variables Back”, select the variable
bGoBackfrom the Input Assistant. For the property “Control variables Forward”, select the variablebGoForward. -
In “General Controls”, add the “Button” element to your visualization two times.
-
Click a “Button” in the visualization editor and drag the “Button” to the required position (for example above the “Web Browser” element).
-
In the property “Texts Text”, specify the character
>. In “Text properties Font”, select a font from the Input Assistant (example:Arial, Bold, 14). -
Configure the property “Input configuration OnMouseClick” so that the variable
bGoForwardswitches. -
Configure the second button for back navigation in the same way as described in Steps 5 to 7.
If the variable
bSetURLhas the valueTRUE, then the website'http://de.wikipedia.org'is displayed with the forward and back buttons. When you click the buttons, navigation to the previous and next websites is successful.