Configuring User Inputs for Visualization Elements

All base elements and some common control elements have the Input configuration property. This is where you can configure a user input for an element. For this purpose, you select an input event and an input action.

Configuring user inputs

Requirement: A project is open with a visualization.

  1. Open the visualization and added a Button element.

    ⇒ The Properties view opens for the new button.

  2. Configure the property Text with Number of clicks: %i.

  3. Declare a variable iClicks : INT; in the application in the PLC_PRG POU.

  4. Configure the Text variable property of the button as PLC_PRG.iClicks.

    ⇒ At runtime, its variable value will replace the placeholder in the Text property.

  5. In the Input configuration property, click the Configure button in the OnMouseClick line.

  6. Select the Execute ST code action from the list of possible actions and click the symbol.

    ⇒ The action appears in the list of actions to be executed. The blank implementation of the action appears in the window area to the right of the list.

  7. Program the action in the editor at Execute ST code:

    PLC_PRG.iClicks := PLC_PRG.iClicks + 1;

  8. Click OK to close the dialog box.

    ⇒ The user input is configured.

  9. Compile, download, and start the application.

    ⇒ The application runs. The visualization opens. If the user clicks the button, then the action is executed, the variable PLC_PRG.iClicks is incremented, and the number of clicks is printed.

See also