Professional Documents
Culture Documents
How Do You Control Pop-Up Windows in WinCC Unified PC RT and Comfort Panels Via S... - ID - 109810540 - Industry Support Siemens
How Do You Control Pop-Up Windows in WinCC Unified PC RT and Comfort Panels Via S... - ID - 109810540 - Industry Support Siemens
com)
Industry Online Support
Product Support
Home (start)
Product Support
...
...
Automation software
TIA Portal
Visualization
SIMATIC WinCC Unified (TIA Portal)
Entry type:
FAQ
Entry ID:
109810540,
Entry date:
07/11/2022
)1(
Rate
How do you control pop-up windows in WinCC Unified PC RT and Comfort Panels via
script (JavaScript examples)?
Entry
Associated product(s)
With the help of JavaScript, numerous properties of pop-ups can be adapted to the specific Runtime requirements in WinCC Unified. All
functions presented in the following use the UI.PopupScreenWindows object (UI object). This object contains all open pop-up instances of
faceplates or screen windows.
1. Prevent a pop-up from opening multiple times (#chapter_5605916_0)
1.1 List open pop-up windows (#chapter_5605916_1)
1.2 Access the instance of a pop-up via its title (#chapter_5605916_2)
1.3 Close all open pop-up windows simultaneously (#chapter_5605916_3)
2. Properties of Pop-up Windows (#chapter_5605916_4)
2.1 Change the properties of the open pop-ups (#chapter_5605916_5)
2.2 Overview: Properties and methods of pop-up windows (#chapter_5605916_6)
3. Implement an operation lock when the pop-up is open (#chapter_5605916_7)
Description
To script pop-ups that are active in Runtime, list their open instances using the "PopUpScreenWindows" subobject of the UI object. In the following you will also find script examples based on this, with the help of which you can program the following functions:
Here you can download the associated sample project with all the functions described in the following:
Script functions
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en) 0.0.0.0
1. Prevent a pop-up from opening multiple times
1.1 List open pop-up windows
Application case
With WinCC Unified you can configure several pop-up windows in one screen.
In Runtime, in principle, several instances of one and the same pop-up can be opened.
If you do not want this behavior, you can prevent it as described in the following example.
Notes
The instances of all opened pop-ups are contained in the UI object together with their properties, as already described at the beginning.
In the WinCC Unified property "Name", the instances of pop-ups contain a name generated dynamically by the system at Runtime.
The value of a pop-up instance located in the "Name" property is clearly different from its title ( see Fig. 03).
The following function counts the open pop-ups in a loop and queries which pop-ups are currently open in Runtime.
One after the other, it compares the title of a pop-up to be opened (in the example "Popup_1") with the titles of the pop-ups that are already open.
This way, it checks whether a pop-up has been opened before.
If this is not the case, it opens the pop-up at the defined position with "Visible".
To be able to access the instance of the pop-up at a later time, the name of the pop-up is stored in a tag.
In the example shown in Fig. 01,the functionis assigned to the "Release" event of the corresponding "Open PopUp"button.
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en) 0.0.0.0
Fig. 01
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en)
03 let title = "Chosen_popup_title"; // 0.0.0.0
title name for search whether pop-up exist
04
08
09 for (let i = 0; i < count; i++) { // loop through all existing pop-ups
10 let popup_title = ui.PopupScreenWindows(i).Caption.Text;
13 }
14 }
15
16 if (popup_exist == false) { // if popup with specific title wasn't found, create
22
23 Tags("Popup_Name_1").Write(po.Name); // save system name of the pop-up instance in a tag
24 }
Application case
You want to read the system name assigned at Runtime of an open pop-up window. In the example, the
ScreenWindowName ( Fig. 02) of an instance of "Faceplate_1_V_0_0_1" (Fig. 01) is read:
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en) 0.0.0.0
Fig. 02
Like the script in Fig. 01, this uses an instance of the UI object to compare all pop-ups listed there with the previously defined title. If the searched pop-up is found, the system name of the pop-up instance is passed to the "value" tag and returned as a
process value.
The script in Fig. 03 is stored directly in the "Process value" property of the corresponding IO field.
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en) 0.0.0.0
Fig. 03
Behavior in Runtime
Figure 04 shows as soon as you press and release a button, for example "Open PopUp 1", the script in Fig. 02 updates the process value linked there after the specified cycle with the current system nameof the open pop-up instance (in the example
"FaceplatePopupWindow_51"). When you close PopUp 1, the script does not find a corresponding faceplate/pop-up instance and indicates that this pop-up is closed ("Open PopUp 2").
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en) 0.0.0.0
Fig. 04
Here you have to start with the highest index number, because with every "close" the still open windows are renumbered. The Count PopUps field in Fig. 06 shows the number of pop-ups currently open.
The function in Fig. 05 is stored in the "Release" event of the "Close all" button.
Fig. 05
Fig. 07 shows how the script changes the color of the title bar in Runtime at the push of a button.
The function is stored in the "Release" event of the "Change Caption Color..." button.
Fig. 06
05 let color = HMIRuntime.Math.RGB(233,200,150)
06
09 }
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Digital ID (http://www.siemens.com/digital_id_en) 0.0.0.0
Fig. 07
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Use the debugger to get a complete
Digital ID overview of the properties and methods
(http://www.siemens.com/digital_id_en) of a pop-up.
0.0.0.0
Fig. 08 shows an example of various properties of a pop-up window using the debugger:
Fig. 08
How do you use the Script Debugger with WinCC Unified and the Chrome browser? (/cs/document/109779192/how-do-i-use-the-script-debugger-with-wincc-unified-and-the-chrome-browser-?lc=en-ww)
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
3. Implement an operation lock Digital
whenIDthe pop-up is open
(http://www.siemens.com/digital_id_en) 0.0.0.0
The script in Fig. 09 implements an operation lock on the button "Show/Hide Circle" as long as pop-up windows are open in Runtime.
If the number of opened pop-ups is 0, the button operation is allowed. Otherwise, operation is locked.
The script is implemented in the "Allow operator control" property of the button mentioned above.
Fig. 09
Additional Keywords
Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to
implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions
constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration. (https://www.siemens.com/cybersecurity#Ouraspiration)
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)
Also available in the followingDigital
languages:
ID (http://www.siemens.com/digital_id_en) 0.0.0.0
German
Spanish
Rate entry
no rating Submit rating
You want to discuss in our forum and exchange experiences with other users
Go to the Forum (/forum/ww/en)
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we
have no further questions, you will not hear from us.
© Siemens AG 2009-2022 - Imprint (http://www.siemens.com/corporate_info) Privacy policy (http://www.siemens.com/privacy) Cookie policy (http://www.siemens.com/cookie-policy-en) Terms of use (http://www.siemens.com/terms_of_use)