Creating Modal Operator Message Popups in WinCC V7 and Unified

David Krause11 min read
SiemensTutorial / How-toWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Creating Modal Operator Message Popups in WinCC V7 and WinCC Unified

Operator-driven confirmations are a recurring requirement on HMI/SCADA systems. The operator must acknowledge a state change (recipe select, valve open, motor start) before the PLC executes the action, and the runtime must block all background input until the operator commits or cancels. This article documents the canonical approach in Siemens WinCC for both the classic V7/SCADA line and the TIA Portal-based WinCC Unified line, and shows how to wire the popup to tag bits, events, and screen-window controls so that the underlying process screens are fully locked while the dialog is on top.

1. Overview of the Two Popup Models

WinCC exposes two structurally different popup mechanisms. Selecting the right one determines which system functions, scripting language, and tag types you can use.

Property WinCC V7 / WinCC Professional (Classic RT) WinCC Unified (TIA Portal, RT Unified)
Configuration environment WinCC Explorer / TIA Portal (HMI part) TIA Portal only
Scripting language VBScript (ANSI-C optional) JavaScript (ECMAScript 2020+)
Native modal dialog No native modal; uses screen window with modal layer + disabled tags Yes – OpenScreenInPopup() with modal flag
Primary system functions OpenScreenInPopup (WinCC V7.4+), picture-window control via SetVisible HMIRuntime.UI.OpenScreenInPopup, HMIRuntime.UI.ClosePopup
Tag model Binary / word tags on the AS connection PLC tags, internal HMI tags, or script tags
Recommended for Migration projects, large existing HMI stations New builds, TIA V17+ projects, multi-client Unified PC

The Siemens entry point for Unified is the scripting example Opening and closing a screen in a pop-up window (RT Unified). The same call surface also covers the classic OpenScreenInPopup / ClosePopup pattern used in WinCC V7 since V7.3.

2. Prerequisites

  1. Engineering: TIA Portal V17, V18, V19, V20, or V21 for Unified; WinCC V7.4 SP1 or later for the classic line. V17+ is recommended for the latest OpenScreenInPopup signature changes.
  2. Runtime: WinCC Runtime Unified V17+ (PC or Comfort Panel) or WinCC RT Professional / WinCC V7.x runtime license.
  3. PLC connectivity: A configured HMI connection to the S7-1500/1200/300/400 or a third-party controller with a tag mapping that exposes the operator-request bits.
  4. Screen: A separate faceplate or screen for the operator message (e.g. Popup_OperatorMessage) – do not embed the prompt inside the process screen, or the modal layer logic becomes ambiguous.
  5. Tags (minimum set):
    • OP_Trigger_Word (Word) – the message ID or selection index written by the AS.
    • OP_Request (Bool) – request line set by the AS, reset by the HMI once the operator commits.
    • OP_Result_Word (Word) – HMI→AS result register (Acknowledge / Cancel / Button-1..N).
    • OP_Popup_Active (Bool, internal) – HMI-side flag that drives the screen-window visibility.
Safety note: The popup is a HMI convenience, not a safety guard. Critical interlocks (SIL/PL) must remain in the PLC and in any F-CPU logic – never rely on the operator pressing "Confirm" as the primary safety barrier. WinCC Comfort Panels and Unified RT are not SIL-rated for E-stop or guard-door logic.

3. Popup Architecture in WinCC

The general flow is identical on both lines. The AS sets a request, the runtime detects it on a scheduled event or a tag change, opens a popup that visually covers the process screen, locks input on every background control, waits for operator action, writes the result back to the AS, and closes itself.

3.1 Sequence Diagram

PLC / AS WinCC RT Popup Screen Operator 1. AS sets OP_Request=1, OP_Trigger_Word=ID 2. RT detects change, calls OpenScreenInPopup 3. Background screen input disabled, modal layer shown 4. Operator clicks Ack / Cancel / Option 5. RT writes OP_Result_Word, calls ClosePopup

3.2 Why the Background Must Be Locked

The original requirement – "I should not be able to click on the background buttons" – is the defining property of a modal dialog. In WinCC Unified, the runtime handles this for you when you call OpenScreenInPopup() with a modal flag. In WinCC V7, there is no built-in modal layer; you must implement it with a full-screen invisible button on top of the process picture, or by using the layer system. Both patterns are covered below.

4. Step-by-Step: WinCC Unified (TIA Portal V17–V21)

4.1 Build the Popup Screen

  1. In the TIA project tree, expand HMI → Screens and add a new screen, e.g. Popup_OperatorMessage.
  2. Insert a Text Field bound to a multilingual text list keyed on OP_Trigger_Word so the same popup screen shows every operator message.
  3. Insert two or more Buttons (e.g. Acknowledge, Cancel, plus optional option buttons). Place them in the lower third of the screen.
  4. Set the screen's Window Properties → Position to a fixed centered position. Width/height are part of the OpenScreenInPopup call.

4.2 Configure the Trigger Event

Open the Scheduler or any screen's Events → Tag value change for OP_Request and attach a ValueChanged event to a JavaScript function:

// Script attached to OP_Request → ValueChanged
import * as UI from "HMIRuntime.UI";

export function OnOpRequestChanged(tag) {
    if (tag.Value === true && Tags("OP_Popup_Active").Read() === false) {
        Tags("OP_Popup_Active").Write(true);

        UI.OpenScreenInPopup("Popup_OperatorMessage", {
            screenName: "Popup_OperatorMessage",
            width: 480,
            height: 240,
            modal: true,            // blocks background input
            headerVisible: true,
            title: "Operator Action Required",
            backgroundColor: 0xFFEEEEEE
        });
    }
}
The modal: true flag is the key option. Without it, the popup becomes a regular child window and the operator can still click buttons on the underlying screen. The full parameter set is documented in the scripting example Opening and closing a screen in a pop-up window (RT Unified).

4.3 Wire the Buttons

Each button's Click event writes a unique code into OP_Result_Word, clears the request, and calls ClosePopup:

import * as UI from "HMIRuntime.UI";

export function OnAcknowledge_Clicked() {
    Tags("OP_Result_Word").Write(1);
    Tags("OP_Request").Write(false);
    Tags("OP_Popup_Active").Write(false);
    UI.ClosePopup("Popup_OperatorMessage");
}

export function OnCancel_Clicked() {
    Tags("OP_Result_Word").Write(99);  // 99 = cancel
    Tags("OP_Request").Write(false);
    Tags("OP_Popup_Active").Write(false);
    UI.ClosePopup("Popup_OperatorMessage");
}

4.4 PLC-Side Acknowledgement

The AS must read OP_Result_Word, react to the code, and then either keep the request low (normal flow) or set a follow-up code. Reset the request only after the AS has read the result, otherwise the RT can fire the popup twice in quick succession.

5. Step-by-Step: WinCC V7 / WinCC Professional (Classic)

5.1 Use OpenScreenInPopup in VBS

Since WinCC V7.4, the runtime exposes HMIRuntime.BaseScreen.OpenScreenInPopup. The signature in VBS is:

Sub OnClick_Trigger()
    Dim sPictName, sPopupName, lWidth, lHeight
    sPictName  = "Main_Process.PDL"
    sPopupName = "Popup_OperatorMessage.PDL"
    lWidth  = 480
    lHeight = 240

    ' Opens the popup; second arg = modal flag (1 = yes)
    HMIRuntime.BaseScreen.OpenScreenInPopup sPictName, 1, sPopupName, lWidth, lHeight
End Sub

The popup window name is generated by the runtime and returned through the FindChildByName / GetParentWindow interface. Close it with:

Sub OnClick_Close()
    Dim objPopup
    Set objPopup = HMIRuntime.ActiveScreen.FindChildByName("PopupWindow_0")
    If Not objPopup Is Nothing Then
        objPopup.Close
    End If
End Sub

5.2 Manual Modal Layer (V7.0–V7.3)

For older projects that cannot use OpenScreenInPopup, build a modal layer manually:

  1. Place a transparent full-screen rectangle on layer 0 of the process picture.
  2. Bind its Visible property to OP_Popup_Active.
  3. Place the popup picture in a Picture Window on layer 10. Layer 10 is above the transparent rectangle on layer 0 only if the rectangle is below it; the picture window therefore intercepts all clicks first.
  4. Disable every button on the process picture while OP_Popup_Active = 1 by adding a script on the Click event: If HMIRuntime.Tags("OP_Popup_Active").Read Then Exit Sub.
This pattern is fragile: every new button added to the process picture must remember to honour the popup-active flag. A global action is the more robust choice – see Siemens FAQ 24325381: How do you generate user-defined operator input messages in WinCC? for a project-wide pattern.

6. Modal Behavior and Screen Locking

Two design rules apply regardless of runtime:

  1. Source of truth lives in the PLC. The HMI reflects OP_Request; the PLC owns the lock. This keeps multi-client / web-client deployments in sync.
  2. Disable, do not just hide. A button set to Invisible while the popup is up can still receive the click on a thin invisible border, producing phantom actions. Use Enabled = 0, or – in Unified – rely on the modal flag.
Scenario Recommended lock mechanism
WinCC Unified Comfort Panel OpenScreenInPopup(..., modal: true)
WinCC Unified PC RT (multi-monitor) OpenScreenInPopup(..., modal: true) + per-monitor check
WinCC V7.x with OpenScreenInPopup Modal flag 1 in OpenScreenInPopup call
WinCC V7.0–V7.3 Layer-based modal + per-button disable
WinCC WebNavigator / WebUX client Tag-based disable only – browser focus may briefly pass through; provide an overlay

7. Result Word Encoding

A single Word tag carries the operator's reply. Encoding is application-specific, but a consistent layout simplifies PLC logic.

Value Meaning AS action
0 No result (initial) Wait
1 Acknowledge / Confirm Proceed with action
2..N Option button 2..N (e.g. recipe select) Use as selection index
99 Cancel Abort / keep state
100..255 Reserved (free for application)

8. Verification

Before sign-off, exercise the dialog with the following checks on the real runtime, not just the simulator:

  1. Modal lock test: Set OP_Request = 1 from the PLC. While the popup is visible, attempt to click a button on the underlying process screen. The button must not trigger any tag change.
  2. Multi-popup test: Trigger the same request twice within 200 ms. The runtime must not stack two popups; the second trigger must be ignored while OP_Popup_Active = 1.
  3. PLC reset test: With the popup open, force OP_Request = 0 from the PLC. The popup must close (idempotent) and OP_Result_Word must remain 0 (operator did not confirm).
  4. Loss of connection: Disconnect the HMI connection. The popup should time out after the configured retry count and the AS should fall back to its default (typically Cancel).
  5. Multilingual test: Switch runtime language. The popup text must follow the active language, not the engineering default.
  6. Audit trail: Each Acknowledge must produce one alarm/event in the WinCC Alarm Control. Verify with the operator log filter.

9. Troubleshooting Matrix

Symptom Likely cause Fix
Popup does not open OpenScreenInPopup called from a screen that is not the active process screen Call from a global action or from a tag change on the active picture; verify with HMIRuntime.ActiveScreen.Name
Background buttons still clickable Modal flag missing or set to false Pass modal: true in Unified; pass 1 as the second argument in VBS
Popup opens twice Request not reset by AS, or OP_Popup_Active guard missing Read result in AS, then reset OP_Request; gate the OpenScreenInPopup call with OP_Popup_Active
ClosePopup has no effect Popup opened with a different name than passed to ClosePopup Use a project-wide constant for the popup name; log UI.GetOpenedPopups()
Popup stays open after recipe change Screen change event fires while OP_Popup_Active = 1 Block the screen change in the same event while the flag is set, or close the popup first
Result word stuck at 0 Result written before the popup is closed; PLC re-reads 0 on the next scan Set OP_Request = 0 and OP_Popup_Active = 0 only after writing the result; AS must handshake on a rising edge
Operator cannot acknowledge on the panel Touch calibration off, or button too small Follow the Siemens panel design guide: minimum 10 mm target size for finger operation

10. Field-Commissioning Notes

  • Update cycle: For critical operator messages, set the cycle of OP_Request to 250 ms on the connection. Higher cycle values delay the popup by up to one cycle and confuse operators into clicking twice.
  • Picture window reuse: A single Popup_OperatorMessage screen serving many message IDs keeps the engineering footprint small but increases the text-list size. Beyond ~50 distinct messages, split into role-specific popups (e.g. Popup_Recipe, Popup_Motor, Popup_Valve).
  • Auditing: Configure an alarm class for operator actions with a retention of at least 30 days; many regulated industries (food, pharma) require 1 year.
  • Performance: On a Unified Comfort Panel MTP1500, expect 50–80 ms to draw the popup from the moment the tag change fires. On a PC runtime, this drops to < 20 ms.
  • Re-entrancy: If your process can raise a second request while the first popup is still open (e.g. motor start while a recipe is being confirmed), buffer the requests in a small queue on the AS side, not in the HMI. The HMI is a single-threaded UI; the AS can sequence.

11. Related Siemens Resources

FAQ

How do I open a modal popup in WinCC Unified?

Call HMIRuntime.UI.OpenScreenInPopup("Popup_OperatorMessage", { modal: true, width: 480, height: 240 }) from a tag-change event on your request bit. The modal: true flag blocks all input on the underlying screens until ClosePopup is called. See the official Unified scripting example.

What is the equivalent of OpenScreenInPopup in WinCC V7?

WinCC V7.4 SP1 and later expose HMIRuntime.BaseScreen.OpenScreenInPopup sScreenPath, 1, sPopupName, lWidth, lHeight in VBScript. The second argument 1 is the modal flag. On V7.0–V7.3 you must build the modal lock with a layer-based overlay and per-button disable scripts.

How do I prevent the popup from opening twice for the same request?

Guard the OpenScreenInPopup call with an internal HMI tag OP_Popup_Active: only open when the request bit rises and the flag is false. Reset the flag inside the Acknowledge / Cancel click handler, after writing the result word and clearing the request.

Can a WinCC popup return a value (e.g. a selection index) to the PLC?

Yes. Bind the popup buttons to a Word tag such as OP_Result_Word and write a unique code per button (1 = Acknowledge, 2..N = options, 99 = Cancel). The AS reads the word on the rising edge of the request and uses the value as a selection index. Encode values 0, 1, 2..N, 99 to keep the handshake simple.

Is the modal popup a safety interlock?

No. WinCC Comfort Panels and Unified Runtime are not SIL-rated. Use the popup as an operator convenience and an audit trail, but keep the actual machine safety in the F-CPU and hard-wired E-stop / guard-door circuits. The popup can never replace a category 3 or 4 stop function.

Back to blog