Skip to content

Button

The Button is a push button that performs an action when the operator clicks it. It is found in the Input - OpenBridge section of the Perspective Component Palette as Button.

Button with a label and an icon

The Button is one of the input components. Events, disabling, icons and the behavior in the Designer are shared by all of them and are described in Input Components — Common Features. This page covers what is specific to the Button.

A Button with default properties and label set to Button:

Button with default properties and a label

A Button dropped from the palette has no label. Set label first.

The Button has no value. When the operator clicks it, it fires the onActionPerformed event once. Configure the event with the action to perform, for example a script that writes to a tag (see Example 1).

A disabled Button does not fire the event.


label is the text on the button. An icon can be shown before the label (hasLeadingIcon), after it (hasTrailingIcon), or both.

Leading icon Trailing icon Both
Button with a leading icon Button with a trailing icon Button with both icons

leadingIcon and trailingIcon are icon names: type the name of an OpenBridge icon, for example openbridge/search. See Icons.

Name Description Property Type
label Text on the button. Empty by default. value
hasLeadingIcon Show an icon before the label. Default false. value
leadingIcon Name of the leading icon. Default openbridge/placeholder. Only shown when hasLeadingIcon is true. value
hasTrailingIcon Show an icon after the label. Default false. value
trailingIcon Name of the trailing icon. Default openbridge/placeholder. Only shown when hasTrailingIcon is true. value

variant selects how prominent the button is:

variant Enabled Disabled
normal (default) The standard button. Normal button Normal button, disabled
raised A filled button, for the most important action in a view. Raised button Raised button, disabled
flat No border or background, for less important actions. Flat button Flat button, disabled
Name Description Property Type
variant normal, raised or flat. Default normal. value

The button is as wide as its label and icons need. Set fullWidth to true to make it fill the width of the component instead. The blue frame in the images is the component’s box:

fullWidth = false fullWidth = true
Button that hugs its label Button that fills the width
Name Description Property Type
fullWidth Make the button fill the width of the component. Default false. value

These work in the same way on every input component, and are described in Input Components — Common Features:

Event Description Event Object
onActionPerformed Fired when the operator clicks the button. —

See Events.

  1. Drop a Button into the view and set label to Start and variant to raised.

  2. Configure the onActionPerformed event with a script action:

    def runAction(self, event):
    system.tag.writeBlocking(['[default]Pump01/StartCommand'], [True])
  3. Bind disabled to an expression that is true when the pump cannot be started, for example {[default]Pump01/Running}.

Built on the OpenBridge Design System