NEXT HMIDocs
The editor / Actions & events

Actions & events

A property answers what a widget shows. An action answers what happens when someone presses it — write a tag, open a screen over the current one, load a recipe, sign a user in, raise a toast. Actions are configured, not scripted, and they compose: every action's fields are ordinary properties, so any of them can be bound to live data.

Where actions live

  • On a widget — Button, Button Container and Menu Toggle carry an Actions field, and a Navigation Menu item can be an action item. The list runs top to bottom the moment the press starts; a Button and a Button Container also carry On Released, which runs when it ends — the finger lifts, the touch is cancelled or the key comes back up. A Button Container is a Container that is one big control around whatever it holds — a tile, a row in a list — that takes the keyboard too (Enter or Space). A press on a Button or an input inside it stays with that control. Other widgets run lists on their own events: On Change on a Dropdown or Button Row, and on a Number Input after each value the operator applies, On Submit (Enter) on a String Input, On Play / On Pause / On Ended / On Error on a Video, On Load / On Error / On Message on a Web Frame.
  • Inside another action — an alert's OK / Cancel buttons, and the onSuccess / onFailed / onSettled handlers of the async actions below, are themselves action lists. Nesting is how a confirm-then-write flow is built.
  • On the project — the Global Events node in the editor tree runs actions at lifecycle moments rather than on a press. See Global events.
  • On a page or page group — an Events section in the node's properties runs actions as the operator arrives and leaves. See Page events.

To change the order of a list, drag an action by the ⋮⋮ grip at the start of its row — or focus the grip, press Space, move it with the arrow keys and press Space again. The same grip moves a Switch / Case case, a value map case, a Navigation Menu item, a Trend Chart variable, a recipe parameter and a Dropdown option or Data Grid column.

Custom widgets fire the same lists through the SDK's executeWidgetActions, so a hand-built control behaves exactly like a Button.

The action catalog

Twenty-three types, in the order the Add action menu lists them. Browse actions… at the top of that menu opens the same catalog as a searchable drawer, grouped as below.

Screens

Action Does
Open Dialog Opens a page from the Dialogs folder — or a whole dialog group, which brings its tabs and chrome along — as a modal on top of the current screen. It also fills in the target's Inputs, which the widgets inside read with the Input source. A Value input takes anything — text, a translation, a formula, a variable — and is read once, as the dialog opens: after that it is the dialog's own, a Write, Toggle or input field inside changes it for this screen only, and nothing goes back to the opener. A Binding input takes a variable only (or a Binding the opener itself received) and stays live inside the dialog wherever it is read — as a whole value, inside an $if, $compare or string expression, or on a Layout field — so the opener can pass one device folder and the dialog works out the rest with slash-paths such as device/Run; a write goes to the controller. To keep a computed value live, pass the variable as a Binding and do the computing inside the dialog. See Value or Binding.
Open Page As Overlay Opens a navigable page from the Pages section — or a page group — as a modal on top of the current screen. Same presentation fields, no parameters: a navigation destination declares none.
Close Dialog/Overlay Closes either kind, by name, or the current one when left empty. Name the page or page group the overlay was opened with — switching tabs inside it doesn't change that.
Navigate To Page Closes every open dialog and overlay — except a dialog with Background usable, which stays where it is, values and all, even when it fired the action itself — then goes to a page from the Pages section, firing its page events as a menu press does. Page is a fixed page, or — inside a dialog — one of its inputs of type Page, so the caller decides where it leads. An input that names no navigable page does nothing. A fixed page that declares Inputs, or sits in a page group that does, gets one field per input under Inputs; each takes any source, is read once in the screen that navigates, and one left empty gives the page its default. Navigating to the page already showing reads the new values again. See Pages for when a page's inputs start at their defaults instead.
Page Group: Next / Page Group: Previous Shows the next or previous page of a page group, as a Tab Bar tab press does. Target group is the group the widget sits in — the nearest group, as for a Tab Bar — or its parent group. In the main screen that changes the page; in a dialog group it changes the tab and the dialog stays open. On the last page Next does nothing, on the first page Previous does nothing: they do not wrap round.
Page Group: Go To Shows the page at Index in the same group, counted from 0 like a Repeater's index. The index takes any source — a number, a PLC variable, a dialog's input — and one outside the group's pages does nothing. An index belongs to a position: reorder the group's pages and an existing Page Group: Go To shows a different one.

Two open actions, one close. The two open actions differ only in which section their picker lists and whether inputs come with it, so each one offers exactly the screens it can actually reach. Move a screen between the two sections and the action that named it no longer fits — the warnings pill flags it and names the one to use instead.

Both open actions carry the presentation fields:

  • Size — auto, small, medium, fullscreen, or fixed (then set Width / Height in pixels).
  • Placement — center, top, bottom, left, right, or one of the trigger-anchored values (trigger-above, trigger-below, trigger-left, trigger-right) which pins the panel to the control that opened it, popover-style. A panel with no room on its side opens on the opposite side of the control when that side has room, and is otherwise kept inside the screen. Anchored placement and fullscreen are mutually exclusive.
  • Backdrop — dim darkens the screen behind, none leaves it untouched (right for a small anchored popover).

Navigation widgets are still the way around. Moving between screens is the job of Navigation Menu, Tab Bar, Breadcrumb and Page Navigator, which read the page tree and stay correct as it changes. See Pages & navigation. Navigate To Page is for a destination chosen at runtime: a station popup's Open station page button, where each caller of the dialog passes its own station's page.

Machine

Action Does
Write Data Variable Pushes a value to a writable tag — a coil, a mode, a setpoint. The Variable row names the tag, picked from the variable picker; the value is a fixed literal typed to match the tag (true/false, a number, text — or a JSON array for a whole-array tag). The value's source pill can take it from one of the dialog's inputs instead (inside a dialog's own actions and events), or from the copy's element (inside a Repeater). Inside a component or a dialog the same pill switches it to an Input that was given a variable (see Passing values into components). Inside a Repeater the Variable row's source pill switches the target to Repeat Item: the copy's own element, or — for a struct element — the member you pick. Pick an element of an array tag (Steps[2]) to write that one, or the array itself: the index box under it then names one element to write — a number, or another value such as a dialog's input; left empty, the action writes the whole array. The server coerces it to the tag's data type on write, and refuses it with read_only when the tag is not writable.
Toggle Boolean Variable Flips a writable Boolean tag — true becomes false and back. The server reads the tag's current value and writes the opposite, so a stale screen or a second panel cannot make it write the wrong state. Only Boolean variables can be picked; pick an element of a Boolean array, or the whole array and then the element to flip in the index box under it — a number, or another value such as a dialog's input. Fails with value_unavailable when the tag has no known value yet, and with read_only when it is not writable.
Edit Value Opens the numpad on a numeric tag — a setpoint behind a tile, a value in a table row — without a Number Input on the screen. Apply writes the entered value, Cancel (×, Escape, a press outside) writes nothing and runs no handler. Title and Unit label the numpad. Min and Max refuse a value outside them; left empty, the tag's own configured range applies, and without one there is no limit. Decimals limits the digits after the point — empty means none for an Integer tag and no limit otherwise — and Allow negative turns the minus key on or off (by default it is off when the lower bound is 0 or more). Position puts the numpad in the center (the default) or bottom right. Only Integer and Float tags can be picked; the target takes a Repeat item inside a Repeater and an Input inside a component or dialog, as for Write Data Variable, and a whole-array tag asks for its element in an index box under the variable, like Toggle Boolean Variable.
Recipe: Load Downloads a saved dataset into its variables. Dataset may be fixed or bound (a row id from a $recipeList grid). Verify reads the values back after writing and fails the action if they didn't take. A parameter bound to a variable that is not writable is skipped and listed in failures as read_only; one that is not enabled in its datasource, as disabled.
Recipe: Save Captures current live values into a dataset. Leave Dataset empty to update the one that is loaded.
Acknowledge All Alarms Acknowledges every unacknowledged alarm in the name of the user signed in on this panel. Put it on a Button next to an Alarm List whose Acknowledge is Off, for one large acknowledge button styled like the rest of the screen. A refusal shows a toast.

Session

Action Does
Login User Signs this runtime in with a Username and Password — both properties, so they come from wherever the operator typed them.
Logout User Drops back to the auto-login user.
Update User Adds an account when the Username is new, otherwise changes it: Groups (comma-separated group ids), a new Password, Language. An empty field leaves that part as it is. Only for a user admin.
Delete User Removes the account named by Username. Only for a user admin; your own account and a locked one are refused.
Change Own Password Sets the signed-in user's password from New password, after checking Current password.

See Users, groups & permissions for the sign-in screen around them, and Manage users from the runtime for a user-management screen.

Interface

Action Does
Set Language Switches the interface language by code (nl-NL). See Translations.
Set Theme Switches the active theme by id — day/night buttons, or a per-line brand. See Theming.
Show Alert A modal with a Title, Description, and two buttons whose captions you set. OK and Cancel each run their own action list, which is how you gate a dangerous write behind a confirmation. dismissible decides whether clicking away counts as cancel.
Show Toast A transient message — severity info / success / warning / error, discard auto (after duration, 4000 ms by default) or manual. The message is a property, so $loc and $var work in it.
Reload HMI Reloads the HMI in this browser, as a page refresh does — a Restart HMI button. It reloads only this screen: other panels and the server keep running, and the actions after it in the list do not run.

Logic

Action Does
Delay Waits Duration milliseconds, then runs the actions after it. A write goes to the PLC and comes back; a Show Toast after a short Delay reads the value the PLC confirmed, so it can say Lower limit set to −25 g.
If / Else Evaluates a Condition — a Boolean variable, a comparison ($compare: Mode = 2, Level > 80), a negation, a user-group check — and runs its Then list when it holds, its Else list when it does not. Branches take any actions, including another If / Else. The condition reads the value the panel has at that moment.
Run Component Actions Inside a component: runs the actions each instance sets on one of the component's Actions properties, picked under Actions. A menu tile built as a component carries one in its Button Container's list, and every tile on the page then does what its own instance says. It sits in the list like any other action, so the tile can do something of its own before or after.

Async actions and $result

Ten actions cross the wire and therefore may fail: Write Data Variable, Toggle Boolean Variable, Edit Value, Recipe: Load, Recipe: Save, Login User, Logout User, Update User, Delete User, Change Own Password. Each carries three optional handler lists:

  • onSuccess — the server acknowledged.
  • onFailed — the server refused, or the request timed out (10 seconds) or the connection dropped.
  • onSettled — always, after whichever of the two ran.

Inside those handlers the $result source reads fields of what came back. Which fields exist depends on the action:

Action onSuccess onFailed
Login / Logout User username, groups, groupLabels reason
Write Data Variable · Toggle Boolean Variable datasource, path datasource, path, reason
Edit Value value (what was entered), previous (what the tag held when the numpad opened), datasource, path the same, plus reason
Recipe: Load result, datasetId, written, total, verified, failures reason
Recipe: Save datasetId reason
Update User username, created reason
Delete User · Change Own Password username reason

onSettled sees the union of both. The reason vocabulary is fixed, so you can branch on it with $compare:

invalid_credentials · rate_limited · bad_request · bad_path · bad_field · invalid_value · opcua_unreachable · write_failed · array_index_out_of_bounds · array_state_unavailable · value_unavailable · read_only · disabled · forbidden · locked · invalid · not_found · wrong_password · unavailable · timeout · disconnected

A worked pattern — a Start button that confirms, writes, and tells the operator either way:

Button "Start"
└─ Show Alert   title "Start line 3?"  ok "Start"  cancel "Cancel"
   └─ onOk
      └─ Write Data Variable   LinePLC:Line3/Start = true
         ├─ onSuccess → Show Toast  "Line started"        severity success
         └─ onFailed  → Show Toast  { $result: "reason" }  severity error

No handlers means fire-and-forget. An action with all three lists empty skips the request/response round trip entirely — which is what you want for a control that writes continuously, like a slider being dragged.

Global events

Some things should happen because the system reached a state, not because someone pressed something. Select Global Events in the editor tree and attach action lists to:

Event Fires
onHmiLoaded Once, when a runtime finishes loading. The place for start-up state: pick a theme from the device, raise a "connecting" toast, open a lock-screen overlay. It waits until the values of the first page and of the variables its own actions read have arrived, up to 3 seconds, so a first-start guard such as an If on Machine/Initialized reads the tag, not "no value yet". The first onPageLoaded runs right after it.
onPageLoaded On the first page and on every navigation afterwards.
onUserLoggedIn When someone signs in on this runtime: on the screen, or on its panel over API v1. A reload that keeps the sign-in fires it again; switching from one signed-in user to another does not. The Auto-login user a screen starts as is not a sign-in, even when it is a real user.
onUserLoggedOut When the sign-in ends and the screen goes back to the auto-login user: a Logout User, a sign-out over API v1, or the signed-in user being deleted.
onLocaleChanged When the active language changes (not on the initial load).
onInteractionDenied When someone presses a widget that is not Interactable — the place to open your sign-in dialog. Runs whatever the Locked feedback mode is.
Variable Changed Per variable you add: whenever its value changes, and once at start-up with the value it already has. It watches its variable on every page. To act on one value only, put an If on that same variable around the actions — for example If Line/DoorOpen then Open Dialog opens a popup when the bool goes high, and does nothing when it goes low.

They are scoped to the runtime that triggered them, so on a multi-panel installation each screen runs its own — one operator signing in on the line-side panel does not fire onUserLoggedIn in the control room.

Variable Changed runs on every open screen. Each runtime watching the variable runs the actions itself. A popup or toast per screen is what you want; a Write Variable writes once per open screen, so leave writes that must happen exactly once to the PLC.

Page events

onPageLoaded above fires for every page. When only one screen should react, put the actions on that screen instead: select a page or a page group and fill in its Events section.

Event Fires
Page Open / Group Open When the operator arrives at this node.
Page Close / Group Close When the operator leaves it.

In the Dialogs folder the same two events are labelled Dialog Open / Dialog Close and Dialog Group Open / Dialog Group Close.

A page opens and closes on every arrival and departure — a subscribe-on-arrival, unsubscribe-on-exit pair, or a write that puts a machine into the mode the screen is for.

A page group is entered and left as a whole. Moving between two pages inside the same group does not close it, so group-level actions are the place for setup that all its screens share rather than something each page repeats. Nested groups unwind in order: leaving a deep page closes the page, then the inner group, then the outer one; arriving opens them outermost-first.

Reusing a page as a modal counts too — a page shown by Open Dialog or Open Page As Overlay fires its own Open and Close events. Its groups are not entered, since nothing navigated into them. A dialog's events run with its Inputs in scope, so a Dialog Open can write the values it was opened with to the machine. A page's and a page group's events in the Pages section read their Inputs as the widgets on the page do: Page Open what the page starts with, Page Close what it holds when the operator leaves.

Order across the two mechanisms is fixed: the project-wide onPageLoaded runs before the arriving page's own Page Open.

Close is not a shutdown hook. It fires on navigation, not when a browser tab is refreshed or closed — the runtime cannot reliably run an action list on the way out. Anything a machine depends on for safety belongs in PLC logic, not in a Page Close handler.