Problem Definition: Expandable Subsignal Grouping in WinCC V7.2 Runtime
Engineers building operator interfaces in WinCC V7.2 frequently face screen real-estate pressure on overview displays. A single overview faceplate must represent dozens of process objects, each with multiple boolean sub-status points (Running, Stopped, Fault, Warning, Remote, Auto, Manual, Maintenance Request, Bypass Active, etc.). Laying all these sub-indicators flat consumes vertical pixels that the project does not have.
The functional requirement is identical to a Windows Explorer tree: a single parent row (e.g., "Production Mode") with a leading "+" glyph that, when clicked, expands to expose the child indications (Motor 1 Running, Motor 1 Stopped, Motor 1 Fault, Conveyor 2 Running, etc.) directly below it. A second click on the same glyph collapses the children. This pattern is also known in HMI documentation as a "tree control", "expandable group", or "drill-down indicator group".
WinCC V7.2 does not ship with a native Smart Object that implements an expandable node tree. Two production-proven approaches exist:
- Microsoft TreeView ActiveX Control (MSComctlLib.TreeCtrl) embedded into the Graphics Designer screen, paired with one or more Picture Window objects that host the child faceplates.
- Visibility-animated symbol grouping using multiple static I/O field objects whose Visible property is toggled by a click on the "+" graphic, simulating a tree without any ActiveX dependency.
Approach 1 produces a true, scrollable, keyboard-navigable hierarchical display and is the recommended method when more than three levels of nesting are needed. Approach 2 is acceptable for shallow (one or two levels) groupings and avoids the ActiveX-licensing and 32/64-bit considerations that accompany MSComctlLib.
Solution Architecture: Picture Windows + TreeView ActiveX
The runtime composition is intentionally simple:
-
Parent process screen (e.g.,
Overview.pdl) hosts one TreeView ActiveX instance plus one or more Picture Window objects positioned at the lower edge of the TreeView. -
Subsignal faceplates (e.g.,
Motor_Faceplate.pdl,Valve_Faceplate.pdl) are stored in the project'sGraCS\picture directory and are loaded into the Picture Window on demand. - Internal WinCC tags drive both the TreeView node text (label strings) and the dynamic indicators inside the child faceplate (color, fill, blink rate).
-
VBScript event handlers on the TreeView's
NodeClickevent and on the Picture Window'sOpentrigger link the two controls.
| Layer | Component | File / Object | Purpose |
|---|---|---|---|
| Presentation | Graphics Designer | Overview.pdl | Main runtime faceplate with TreeView and Picture Window |
| Presentation | TreeView ActiveX | MSComctlLib.TreeCtrl | Hierarchical node list with expand/collapse |
| Presentation | Picture Window | Smart Object - Picture Window | Hosts child faceplate with built-in slider |
| Presentation | Subsignal faceplates | Motor_Faceplate.pdl, Valve_Faceplate.pdl | Per-asset indicator layouts |
| Data | WinCC Tags | Internal / External tags | Drive node text, colors, visibility |
| Logic | VBScript | Event handlers in Graphics Designer | Populate tree, react to clicks, swap faceplates |
| Logic | C / ANSI-C | Optional global actions | Tag polling, alarm acknowledgment |
| Runtime | WinCC Runtime | WinCC Explorer - RT | Hosts the loaded screens |
Prerequisites and Licensing
Before starting the configuration, verify that the following prerequisites are in place:
- WinCC V7.2 with at least SP1 installed. SP3 is recommended and is available from the Siemens Industry Online Support portal under entry ID 109751769 (WinCC V7.2 SP3 Update). The TreeView ActiveX control is part of the Windows operating system and does not require a separate WinCC license, but the WinCC runtime license model (RC 128 / RC 256 / RC 512 / RC 1024 / RC 2048 / RC 4096 / RC 8192 / RC 16384 Power Tags) governs how many process tags can be referenced.
-
Windows 7 SP1 / Windows Server 2008 R2 or later host operating system. WinCC V7.2 is a 32-bit application and must run on a 32-bit or WOW64 subsystem. The MSComctlLib TreeView ActiveX is a 32-bit OCX (
mscomctl.ocx) and is registered automatically on supported Windows versions. - Graphics Designer licensed and operational in the WinCC Explorer.
-
Microsoft Visual Basic Scripting engine is part of the WinCC installation; verify
C:\Windows\SysWOW64\vbscript.dllexists. -
Project access with rights to edit the
GraCS\folder and the WinCC tag database.
regsvr32 "C:\Windows\SysWOW64\mscomctl.ocx" if the control is not present in the ActiveX selection list.Step-by-Step: Building the Parent Screen and Embedding the Picture Window
- Open WinCC Explorer and double-click Graphics Designer.
- Right-click in the Graphics Designer navigation pane and select New Picture. Name it
Overview.pdl. - Set the picture properties: Geometry width = screen resolution minus 60 px gutter; Background color = project standard (e.g., R 32, G 48, B 70).
- From the Smart Objects palette, drag a Picture Window onto the screen. Place it at the lower 40% of the screen with a fixed width and a height that allows the slider to appear when content overflows.
- Open the Picture Window configuration dialog. In General tab, set Window position = Relative. In Properties tab:
-
Screen Name= empty at design time; it will be filled at runtime by VBScript. -
Visible= No (the Picture Window opens only on click). -
Caption= No. -
Border= Yes (thin 1-px border for visual separation). -
Slider (Horizontal / Vertical)= Yes / Yes (this is the built-in scrollbar that the original requirement explicitly specified). -
Adapt Picture= No,Adapt Screen= No. -
Window Mode= Standard.
-
- Save the screen. The Picture Window now exists in the layout but is invisible at startup.
Step-by-Step: Adding the TreeView ActiveX Control
- Right-click anywhere on the Graphics Designer palette and choose Add/Remove Controls. Tick ActiveX Controls if it is not already present.
- From the Controls palette (top of the right column), select the ActiveX Controls tab.
- Locate Microsoft TreeView Control 6.0 (SP6) - the ProgID is
MSComctlLib.TreeCtrlfrom the filemscomctl.ocx. Drag it ontoOverview.pdl. - Right-click the new control and select Properties. Configure:
-
Name=TreeView1 -
LineStyle= 1 -tvwRootLines(vertical and horizontal guides between nodes) -
Style= 7 -tvwTreelinesPlusMinusText(this produces the "+" / "-" glyph next to the parent node) -
Indentation= 24 px (default) -
HotTracking= False (prevents underline flicker on legacy HMI displays) -
HideSelection= False (operator must see selection after click) -
LabelEdit= 0 -tvwManual(read-only - operators must not edit node text)
-
- Resize the TreeView to occupy the upper 60% of
Overview.pdl. Set Position X / Y / Width / Height in the Geometry tab. - Save the screen.
Step-by-Step: Building the Subsignal Subscreens
Each subsignal group (Production Mode, Maintenance Mode, Alarm Group, etc.) is a separate faceplate in the GraCS\ folder. The minimum faceplate structure is:
- Create
Motor_Faceplate.pdlwith:- One rectangle header (project color #205080, height 24 px) with a static text field Motor Status.
- Four status rows, each containing:
- A circle (Diameter 14 px) whose Fill color is dynamic via a tag.
- A static text label (e.g., "Running", "Stopped", "Fault", "Warn").
- Color mapping: green (0, 200, 0) for ON, gray (96, 96, 96) for OFF, red (220, 30, 30) for fault, amber (240, 160, 0) for warning.
- Repeat for additional asset types. Naming convention:
{AssetType}_Faceplate.pdl. - Ensure each faceplate fits within the Picture Window's static visible area; the slider appears automatically when content exceeds the window.
Plant1.MotorA. and append Running, Stopped, Fault inside the faceplate. This lets a single faceplate design serve many assets.Variable and Tag Configuration
The TreeView node text and the faceplate content both depend on WinCC tags. Create the following structure in the WinCC Tag Management:
| Tag Name | Data Type | Source | Used By |
|---|---|---|---|
| Plant1.Overview.Groups[0].Label | Text tag, 32 chars | Internal | TreeView root text |
| Plant1.Overview.Groups[0].Count | Signed 16-bit | Internal | Number of child subsignals |
| Plant1.MotorA.Running | Binary | PLC (AS) | Faceplate indicator |
| Plant1.MotorA.Stopped | Binary | PLC (AS) | Faceplate indicator |
| Plant1.MotorA.Fault | Binary | PLC (AS) | Faceplate indicator |
| Plant1.MotorA.Warning | Binary | PLC (AS) | Faceplate indicator |
| Plant1.Overview.SelectedGroup | Signed 16-bit | Internal | Tracks which tree node was clicked |
| Plant1.Overview.SelectedFaceplate | Text tag, 64 chars | Internal | Picture Window screen-name override |
For PLC-driven group labels (for example, equipment name string returned from the AS), expose the text tag via the PLC connection and map it into the structure above. The Siemens Industry Online Support portal hosts the WinCC V7.2 Communication Manual with the exact AS-driver configuration for S7-300/400, S7-1200/1500, PROFIBUS, and PROFINET.
VBScript Logic for TreeView Population and Click Handling
Two event handlers are required. Place both in the Events tab of the relevant screen object.
Event 1: Screen open - populate the TreeView
' WinCC V7.2 Graphics Designer - VBScript
' Event: Picture "Overview.pdl" - Event "Open"
Option Explicit
Sub OnOpen()
Dim tv
Set tv = ScreenItems("TreeView1")
tv.Nodes.Clear
' --- Root node 1: Production Mode ---
Dim nRoot
Set nRoot = tv.Nodes.Add(, , "G_PROD", "Production Mode")
nRoot.Expanded = False
tv.Nodes.Add "G_PROD", 4, "G_PROD_M1_R", "Motor 1 Running" ' 4 = tvwChild
tv.Nodes.Add "G_PROD", 4, "G_PROD_M1_S", "Motor 1 Stopped"
tv.Nodes.Add "G_PROD", 4, "G_PROD_M1_F", "Motor 1 Fault"
tv.Nodes.Add "G_PROD", 4, "G_PROD_C2_R", "Conveyor 2 Running"
tv.Nodes.Add "G_PROD", 4, "G_PROD_C2_F", "Conveyor 2 Fault"
' --- Root node 2: Maintenance Mode ---
Dim nMaint
Set nMaint = tv.Nodes.Add(, , "G_MAINT", "Maintenance Mode")
nMaint.Expanded = False
tv.Nodes.Add "G_MAINT", 4, "G_MAINT_B1", "Bypass 1 Active"
tv.Nodes.Add "G_MAINT", 4, "G_MAINT_B2", "Bypass 2 Active"
tv.Nodes.Add "G_MAINT", 4, "G_MAINT_OVR", "Operator Override"
' --- Root node 3: Alarms ---
Dim nAlm
Set nAlm = tv.Nodes.Add(, , "G_ALM", "Alarms")
nAlm.Expanded = False
tv.Nodes.Add "G_ALM", 4, "G_ALM_HI", "High Priority Active"
tv.Nodes.Add "G_ALM", 4, "G_ALM_MED", "Medium Priority Active"
tv.Nodes.Add "G_ALM", 4, "G_ALM_LO", "Low Priority Active"
End Sub
Event 2: TreeView click - swap the Picture Window faceplate
' Event: TreeView1 - "NodeClick"
Option Explicit
Sub OnNodeClick(ByVal Node)
Dim pw
Set pw = ScreenItems("PictureWindow1")
' Map the clicked node key to a faceplate file
Select Case Node.Key
Case "G_PROD", "G_PROD_M1_R", "G_PROD_M1_S", "G_PROD_M1_F", _
"G_PROD_C2_R", "G_PROD_C2_F"
pw.ScreenName = "Motor_Faceplate.pdl"
pw.TagPrefix = "Plant1.MotorA."
pw.Visible = True
Case "G_MAINT", "G_MAINT_B1", "G_MAINT_B2", "G_MAINT_OVR"
pw.ScreenName = "Maintenance_Faceplate.pdl"
pw.TagPrefix = "Plant1.Maint."
pw.Visible = True
Case "G_ALM", "G_ALM_HI", "G_ALM_MED", "G_ALM_LO"
pw.ScreenName = "Alarm_Faceplate.pdl"
pw.TagPrefix = "Plant1.Alarms."
pw.Visible = True
Case Else
pw.Visible = False
End Select
' Persist the selection for global actions / cross-screen references
HMIRuntime.Tags("Plant1.Overview.SelectedGroup").Write CLng(Node.Index)
HMIRuntime.Tags("Plant1.Overview.SelectedFaceplate").Write pw.ScreenName
End Sub
ScreenItems("Name") for object access and HMIRuntime.Tags("Name") for tag I/O. The HMIRuntime object is the entry point to the WinCC runtime services and is documented in the WinCC V7.2 Scripting Manual (entry ID 109751769 on the Siemens support portal).Event 3: Picture Window open - propagate tag prefix into the loaded faceplate
' Event: PictureWindow1 - "Open" or "OpenFaceplate"
Option Explicit
Sub OnOpen(ByVal Item)
' The PictureWindow1.TagPrefix property is evaluated at open time.
' Internal tags inside the loaded faceplate use prefix + suffix.
' Example: TagPrefix = "Plant1.MotorA." plus internal "Running" yields "Plant1.MotorA.Running"
Dim sPrefix
sPrefix = ScreenItems("PictureWindow1").TagPrefix
' The tag-prefix convention must match the inside of the loaded faceplate.
' If the faceplate was designed with hard-coded absolute tags, omit this handler.
End Sub
Visibility-Animation Alternative (Without ActiveX TreeView)
If the project cannot ship MSComctlLib (for example, on a hardened RDP/Citrix deployment where the OCX is not available), the same visual effect can be implemented with native WinCC objects and the Visible property animation. The pattern is:
- Place a static plus graphic (+.bmp or +.emf) and a static minus graphic (-.bmp or -.emf) at the leading edge of each group header.
- Place the subsignal I/O fields directly below the group header with an initial
Visible = No. - Create an internal tag
Plant1.Overview.GroupX.Expanded(binary) per group. - Animate plus graphic -> Visible =
NOT GroupX.Expanded. - Animate minus graphic -> Visible =
GroupX.Expanded. - Animate each subsignal I/O field -> Visible =
GroupX.Expanded. - Configure a Click event on the plus/minus graphic with a VBScript one-liner:
HMIRuntime.Tags("Plant1.Overview.GroupX.Expanded").Write NOT CLng(HMIRuntime.Tags("Plant1.Overview.GroupX.Expanded").Read)
This approach is documented in the WinCC V7.2 Graphics Designer manual under "Configuring Dynamic Dialogs" and "Configuring Animations". The Animation dialog accepts Boolean expressions of unlimited depth and refreshes at the configured update cycle (250 ms is typical for HMI).
| Criterion | TreeView ActiveX (MSComctlLib) | Visibility Animation |
|---|---|---|
| Hierarchy depth | Unlimited | Practical limit ~3 levels |
| Built-in slider | Provided by TreeView + Picture Window | Must use Picture Window slider only |
| Keyboard navigation | Arrow keys, expand/collapse, Page Up/Down | None |
| Memory footprint | Slightly higher (OCX + child objects) | Lowest |
| Citrix / RDP publish | Requires OCX on every client | Native WinCC objects - no client install |
| Configuration effort | Lower (one script populates all nodes) | Higher (per-element animation) |
| Recommended for | Engineering workstations, control rooms | Operator panels, thin clients |
Runtime Activation and Verification
- In WinCC Explorer, right-click the computer and select Properties - Startup. Add
Overview.pdlto the Start Picture list and enable Start WinCC Runtime. - Click Activate in the WinCC Explorer toolbar (or press the green play button).
- WinCC Runtime starts.
Overview.pdlopens. The TreeView should display three root nodes: "Production Mode", "Maintenance Mode", "Alarms", each preceded by a "+" glyph. - Click the "+" on "Production Mode". Verify:
- The "+" toggles to "-".
- The five child nodes appear in indented order.
- The Picture Window at the lower portion of the screen becomes visible and loads
Motor_Faceplate.pdl. - Inside the faceplate, the Running / Stopped / Fault indicators animate based on the current tag values.
- Scroll the Picture Window slider. Verify the slider appears only when the faceplate content exceeds the visible area.
- Click "Maintenance Mode". Verify the Picture Window swaps to
Maintenance_Faceplate.pdlwithin one runtime refresh cycle (default 250 ms). - Click the "-" on a previously expanded node. Verify the children collapse and the Picture Window remains on the last-selected faceplate (this is intentional - collapsing does not unload).
- Deactivate runtime. Open the WinCC Diagnostic Viewer (Start - Programs - Siemens Automation - SIMATIC - WinCC - Tools - Diagnostic Viewer). Verify zero VBScript errors and zero ActiveX exceptions.
Troubleshooting Matrix
| Symptom | Likely Cause | Corrective Action |
|---|---|---|
| TreeView object not in ActiveX list | mscomctl.ocx not registered | Run regsvr32 C:\Windows\SysWOW64\mscomctl.ocx as Administrator. Restart Graphics Designer. |
| "+" glyph missing on root nodes | Style property not set to 7 | Open TreeView properties, set Style = tvwTreelinesPlusMinusText (value 7). |
| Picture Window slider does not appear | Slider flag off, or faceplate content fits in window | Open Picture Window properties, enable Slider Horizontal and Slider Vertical. Reduce the Picture Window height until content overflows. |
| VBScript runtime error "Object required: ScreenItems(...).TagPrefix" | Property name is case-sensitive in some WinCC builds | Use ScreenItems("PictureWindow1").TagPrefix with exact casing. Avoid the older .PictureName property. |
| Faceplate loads blank or with default colors | Tag prefix not propagated, or PLC tags not updated | Open WinCC Tag Management, right-click the prefix root, select Properties - Update. Verify the AS connection is online. |
| TreeView collapses unexpectedly on tag update | OnOpen script re-runs on every tag change | Move the populate code to Open only, not to a tag-triggered event. Use a one-shot internal InitDone tag if re-population is needed. |
| Click on "+" does not expand the node | LineStyle = 0 (no lines) and Style does not include plus/minus | Set LineStyle = 1 and Style = 7. |
| Picture Window flickers when swapped | Visible toggled before ScreenName assigned | In the NodeClick handler, set ScreenName first, then Visible = True. Order matters. |
| Operator cannot find the "+" because the project is rendered on a touch screen at 1024x768 | TreeView node height too small for fingers | Set TreeView Height property per node to 24 px minimum. Increase font size to 14 pt. |
| TreeView ActiveX does not load on Windows 10 64-bit | WinCC V7.2 only supports 32-bit OCX; running it in 64-bit process fails | Verify WinCC Runtime is launched as a 32-bit process via the WinCC Explorer shortcut. Do not launch via a 64-bit command prompt. |
| Node text shows "{I/O field}" placeholder | Tag substitution failed; tag does not exist | Open WinCC Tag Management and confirm the tag exists and is online. Check spelling and case. |
| Picture Window slider visible but cannot be dragged | Picture Window is configured as Adapt Screen = Yes, locking the size | Set Adapt Screen = No. Set fixed geometry for the Picture Window. |
Performance, Licensing, and Migration Notes
-
Refresh cycle: The TreeView repaints only on user interaction or on
OnOpen. Do not bind node text to high-frequency tags (>1 Hz). The faceplate indicators should use the project default update cycle (250 ms or 500 ms). WinCC V7.2 supports per-tag update overrides. - Power tag licensing: Each unique tag referenced by a faceplate counts as a Power Tag. A faceplate that uses a tag prefix and instantiates 50 assets therefore references 50 tags per faceplate-internal variable. Verify the project license tier (RC 128 through RC 16384) covers the total Power Tag count.
- Migration path to WinCC V7.4 / V7.5 / TIA Portal WinCC: The MSComctlLib TreeView is being deprecated in newer WinCC versions. The successor in TIA Portal is the WinCC TreeView as a native control with a redesigned API. The visibility-animation alternative migrates cleanly with no code change.
-
Audit trail: If the operator must log which group was expanded, add a write to the WinCC User Archive or to an internal text tag inside the
OnNodeClickhandler. -
Multi-language: Node text strings should reference text-library entries (
@...) for translation, not hard-coded literals. Text library entries are configured in WinCC Explorer under Text and Graphic Lists.
Where is the TreeView control located in Graphics Designer?
Open Graphics Designer, right-click the Controls palette, choose Add/Remove Controls, enable ActiveX Controls, then drag Microsoft TreeView Control 6.0 (SP6) from the ActiveX tab onto the screen. Its ProgID is MSComctlLib.TreeCtrl backed by mscomctl.ocx.
How do I enable the slider on the Picture Window?
Open the Picture Window properties, go to the Properties tab, and set Slider Horizontal and Slider Vertical to Yes. Set Adapt Screen to No so the slider can be dragged. The slider appears automatically when the embedded screen's content exceeds the window's visible area.
Why does my "+" glyph not show on root nodes?
The TreeView Style property must be set to 7 (tvwTreelinesPlusMinusText) and the LineStyle property to 1. If either is wrong, the tree renders as a flat list with no plus/minus glyphs.
Can I avoid using the ActiveX control entirely?
Yes. Use the Visibility Animation approach: animate the Visible property of each subsignal I/O field to a boolean internal tag that flips on click of a plus/minus graphic. This avoids the OCX dependency and is preferred on Citrix / thin-client deployments where mscomctl.ocx cannot be installed.
How do I pass a tag prefix from the parent screen to a faceplate loaded in a Picture Window?
Set the Picture Window's TagPrefix property in the VBScript handler (for example, pw.TagPrefix = "Plant1.MotorA.") before assigning ScreenName and Visible = True. Inside the faceplate, the tag-prefix is automatically prepended to every internal tag reference, allowing a single faceplate design to serve many assets.