IMDTouchKnowledge BaseShop main store

Troubleshooting

Why stacked HMI controls break buttons and content pages fix it

HMI and touchscreens Published 9 min read

Short answer

Front-to-back ordering only changes which control sits on top, so the top group swallows every press and the buttons beneath stay dead. Give each page its own content object, display it through a region, and put a SetTargetContent action on each navigation button's .onPressed event; the region's Target Content attribute sets the start page.

On this page
  1. Why do buttons stop working when pages are stacked front to back?
  2. How many buttons does one stacked layout actually kill?
  3. Are my pages stacked groups or separate content objects?
  4. How do I create the content pages?
  5. How does a region show the right page?
  6. What goes on each navigation button?
  7. Do visibility toggles and resizing work instead of content objects?
  8. How do I verify every page after the rebuild?
  9. Questions asked

Stacking page groups and shuffling them front to back cannot make pages in TwinCAT HMI: ordering changes only which control sits on top, so the group in front swallows every press aimed at the buttons beneath it, and sending it to the back just moves the dead zone. The documented fix is navigation by content: one content object per page, a region that displays the selected content, and a SetTargetContent action on each navigation button's .onPressed event. This article traces where the presses go, counts what a stacked layout really costs, and walks the rebuild from Solution Explorer to a tested runtime.

Why do buttons stop working when pages are stacked front to back? #

Front/back ordering changes only the stacking order: the topmost control at the press point receives the input event, so a group brought to the front swallows every press and every button underneath stays dead until the covering group is sent to the back.

A visible button is not necessarily the control receiving the press. Bring-to-front and send-to-back actions rearrange one shared stacking order; they never create a page structure, so every group stays in the same layout and only one group is reachable at a time. Confirm the fault before rebuilding:

  • Press a control nothing covers. If it responds, the input device and the runtime connection are healthy and the problem is layout.
  • Press a visible button that sits under another object. No reaction means the covering object is taking the event.
  • Send the covering group to the back. If the buried buttons wake up and the previously live ones die, stacking is confirmed.
  • Watch the display when you press. An event that runs without a page change points to a missing or mistargeted navigation action instead of a stacked layout.

Overlap causes two distinct faults: a graphic that hides the symbols behind it is a visual problem, covered by the guide to fixing overlapping graphics that hide HMI symbols, while a covering control that takes the press is the input problem this article fixes.

How many buttons does one stacked layout actually kill? #

On a panel with four stacked page groups of six buttons each, 24 buttons exist and only 6 can receive a press at any moment: the top group covers the other 18, and every send-to-back just moves the 18 dead buttons to a different group.

The arithmetic, step by step:

  • Total buttons: 4 groups × 6 buttons = 24 buttons on screen.
  • Live buttons: the topmost group alone.
  • Dead buttons: 24 − 6 = 18 buried at every instant.
  • After a send-to-back: the live set just moves to another group; the count does not change.

That is three quarters of the panel unusable at any moment. With content navigation every one of those buttons becomes reachable: the region displays exactly one content at a time, so the displayed page's buttons take presses normally, and a lap through all four pages exercises every button on the panel with none permanently blocked. Nothing about the buttons themselves changes — same tags, same events; only the press routing changes.

Decision: dead buttons only under the front-most group mean the stacked layout is blocking three of every four displayed presses; convert the groups to contents.

Are my pages stacked groups or separate content objects? #

Open Solution Explorer and look at what each page actually is: a real page is a content object added with Add, New Item and Content, while a fake page is a group of controls stacked inside one view or one content.

TwinCAT HMI engineering runs inside Microsoft Visual Studio with a graphical editor, and Solution Explorer is where the page structure lives. A content object is a file in the project; a stacked group is only a container inside the current view. The two look identical on screen at runtime, which is why the layout behaves like pages but routes presses like one flat screen.

Arrangement What a page switch changes Result at runtime
Front/back ordering The stacking order of existing objects One group's buttons live, the rest buried
Visibility toggling Which objects are shown Works only while every transition updates every group
Separate contents in a region The content the region displays Exactly one page exists where the operator presses
Resizing a page out of the way Object geometry Overlap remains, layout grows fragile

Decision: if separate content objects already exist, move on to the region's start content; if the project is all groups and ordering actions, create the contents first, because no further front/back editing will repair the presses.

How do I create the content pages? #

Create one content object per page before touching the layout: right-click the TwinCAT HMI project entry or a folder in Solution Explorer, choose Add, then New Item, then Content, and repeat until every page of the machine has its own file.

  1. In Solution Explorer, right-click the TwinCAT HMI project entry or one of its folders.
  2. Select Add, then New Item, then Content, and name the new file for the page it holds.
  3. Repeat until the project holds one content per machine page.
  4. Move the controls of each old stacked group into its matching content, then delete the groups from the shared view.
  5. Leave the hosting view with only the frame: the region position and nothing that belongs to a single page.

Keep one page per content rather than nesting page groups inside a content, or the overlap problem returns one level down. After this step the old bring-to-front actions have nothing left to rearrange, which is exactly the state to be in before wiring navigation.

Decision: continue only when Solution Explorer lists one content per machine page and the hosting view carries no page controls.

How does a region show the right page? #

Add a region control to the hosting view and set its Target Content attribute to the page the machine should show first: the region displays that content, and the attribute decides what is on screen before any button is pressed.

A region is the frame that displays one content at a time, and the documented navigation pattern sets its Target Content attribute to define the start content the operator sees when the visualization opens. Leave the attribute unset and the runtime shows an empty frame before any press, which reads as a broken project rather than a missing setting. Size the region for the largest page and keep other objects clear of it, so no leftover control covers part of the frame.

Run the project once at this point and compare the frame's initial display with the configured start content. If the start content appears, initialization works and any remaining fault can only sit in the button events; if it does not, correct the region assignment before testing a single navigation button.

Decision: the region shows the configured start content on a plain run before any navigation button is touched.

What goes on each navigation button? #

Every navigation button needs a SetTargetContent action on its .onPressed event, configured with the region it drives and the content it should display; the event is the entry point and the action is the page switch.

What to check Expected If it is wrong
.onPressed event The navigation action belongs to the pressed button Add the action to that button's event, not to a group or the view
SetTargetContent target The selected content matches the button's label Select the intended content object in the action
Region in the action The region that hosts the pages Point the action at the region this layout uses
Later actions on the same event None Delete leftover bring-to-front or visibility actions that reverse the switch

Test one button at a time. A press that runs but opens the wrong page is a wrong destination: fix the content in the action, not the button's geometry. A page that changes and is immediately covered again means an older ordering action is still rearranging objects on the same event or elsewhere in the layout; delete it rather than out-ordering it.

Decision: each button's event carries exactly one navigation action, aimed at the right region and content, with no ordering actions left anywhere in the project.

Do visibility toggles and resizing work instead of content objects? #

They can work, but they scale badly: a Visibility attribute set to hidden frees the buttons underneath only until the next page change, and every transition then has to hide the old group and show the new one for every group in the layout.

With four stacked groups, one transition must set visibility correctly for all of them; miss one group and either the dead-button symptom returns or a needed group stays invisible. The bookkeeping grows with every added page, and nothing in the project records which group should be visible — the state lives only in the events. Resizing a page out of the way, small to hide and enlarged to show, keeps every object in one layout too, so the overlap is still there, only smaller.

Visibility stays the right tool for a deliberate show or hide of a single element, such as a message overlay, where one event owns one object. Whole pages belong in contents.

Decision: single-element show and hide remains visibility; anything an operator would call a page becomes a content object.

How do I verify every page after the rebuild? #

Test one button at a time and come back to pages already visited: press every navigation button, operate at least one control on each page, and confirm the region returns to the configured start content after a full lap through all four pages.

Work down the checks in order:

  • Every navigation button opens its own page, and no page opens blank.
  • At least one control on each page takes a press and writes its tag.
  • Returning to a visited page leaves its controls live again.
  • After restarting the runtime, the region shows the configured start content again.

If a single button still dies after conversion, the covering control now sits inside that content: overlap inside a page follows the same topmost-object rule, so shrink or reorder the covering object within the content instead of splitting the page further. If the press runs but the page never changes, the SetTargetContent action is missing or aims at the wrong content. If nothing on the panel responds at all, the fault is the input device or the runtime connection, not the layout. If the rebuilt project never reaches the browser after a build, deployment is the failing step, and the guide to fixing TwinCAT HMI publish failures after a NuGet update covers that path.

One safety note: before the panel runs the machine again, prove with real presses that a start, stop or safety-relevant button always acts on the object the operator sees.

Decision: every press lands on the visible control on every page, and the panel is a multipage HMI rather than one stacked screen.

Questions asked

Is there a ready-made control for page switching instead of wiring every button?

Yes. The tab navigation control presents several content pages under tabs, and clicking a tab brings its page forward without hand-wired actions. Responsive navigation controls, part of the framework from version 1.12 onward, give prebuilt page menus that adapt to different screen sizes. Either way the structure underneath stays the same: separate content objects shown one at a time.

Where do controls live that must stay reachable on every page?

On the view that hosts the region, outside the region itself. The region swaps only the page body, so a header, an alarm banner or the navigation buttons placed beside it keep working on every page. Anything placed inside a content appears only while that content is displayed, so shared controls duplicated inside several contents drift out of sync.

Does the topmost-object rule also apply to overlapping controls inside one page?

Yes. Inside a single content or view, the topmost object at the press point still receives the input, so a leftover graphic or panel covering a button blocks it the same way stacked pages did. Fix that inside the content by shrinking the covering object or changing its layer position rather than splitting the page again.

What has to change when a new page is added later?

Two additions: create the new content object, and give one more button a SetTargetContent action aimed at the new content and the existing region. No existing page or event needs editing. Change the region's Target Content attribute only if the new page should also become the page shown at startup.

Keep reading

  • Troubleshooting

    Why WinCC Start and Stop buttons do not control an S7-300 output

    The Start and Stop buttons do nothing because E0.0 and E0.1 are S7-300 input image addresses: the CPU refreshes them from the input modules every scan, so an HMI write cannot survive. Step 7 simulation changes the simulated input state itself, which is why the LED follows it. Move the two commands to memory bits such as M0.0 and M0.1, latch them in the PLC, and let the program drive A4.0.

    HMI and touchscreens

  • How-to

    Activate Outputs From an HMI Screen Instead of Wired Inputs

    Drive each output from its own controller output bit, written by the program or by a button object on the HMI touch screen — never by looping through a physical input. Use a motion-synchronized on command (M62) when the action must follow motion timing, an immediate command (M64) when it must switch now, and a toggle or momentary screen button for operator control. Wire buttons to inputs only where a function must work with the screen down.

    HMI and touchscreens

  • How-to

    Binding an HMI button command to a separate feedback color

    Build each illuminated control as two independent bindings: a state or lamp object whose color reads a PLC feedback variable, plus a touch action that writes the command variable. The color then reports what the machine actually did, including a refused or delayed command, instead of echoing the last touch. Force each feedback bit against its command on the bench before release; any lamp that follows its own command fails.

    HMI and touchscreens