Skip to main content

Configuring Text Input

A visualization is usually configured so that it calls a virtual keyboard for a text input event when an input device is not available. For this purpose, the Write Variable follow-up action is preset accordingly in the user input: The value Standard is selected for the Input type setting.

For example, controllers which are employed as CODESYS TargetVisu often do not have a keyboard. A visualization calls a virtual keyboard. In contrast, it usually has a keyboard. A user uses a keyboard to specify the text.

However, you can also especially configure how text is input. For this purpose, more input types are available in the user input, such as Text input or the listed visualizations. These visualizations have the Numpad/Keypad visualization type and display virtual keyboards or numeric keypads.

In the Settings for Default Text Input setting of the Visualization Manager, you can preset a keyboard visualization which is called from all visualizations in the application when required. This is possible without having to customize the user inputs of the visualizations.

Configuring text input as usual

When UTF-8 encoding is enabled for the STRING data type, texts with language-specific characters are allowed. Texts with language-specific characters, such as diacritic characters or Chinese characters, can then be specified both during input and output. You can enable UTF-8 encoding in Dialog: Project Settings: Compile options.

Requirement: A project with a visualization is open. The CODESYS TargetVisu does not have a keyboard.

  1. Declare an input variable in the PLC_PRG program.

    VAR_INPUT stInput : STRING; END_VAR

  2. Add a button to the visualization and select the element.

  3. Configure the Texts → Text property with Text input: %s.

  4. Configure the Text variables → Text variable property with PLC_PRG.stInput.

  5. In the Input configuration → OnMouseClick property, click Configure.

    The Input Configuration dialog opens. The selected input event is displayed below the caption.

  6. Select the Write Variable action.

  7. Select the value Standard in Input type of the implementation of the action.

    The input is configured as usual.

  8. Compile, download, and start the application as CODESYS TargetVisu.

    The visualization opens.

  9. As a visualization user, click the button.

    An input field is displayed with a virtual keyboard which allows text input by means of the mouse.

  10. Compile, download, and start the application as CODESYS WebVisu.

    The visualization opens.

  11. As a visualization user, click the button.

    An input field is displayed and prompts for text input.

Configuring text input especially for virtual keyboards

Requirement: A project with a visualization is open.

  1. Declare an input variable in the PLC_PRG program.

    VAR_INPUT stInput : STRING; END_VAR

  2. Add a button to the visualization and select the element.

  3. Configure the Texts → Text property with Text input: %s.

  4. Configure the Text variables → Text variable property with PLC_PRG.stInput.

  5. In the Input configuration → OnMouseClick property, click Configure.

    The Input Configuration dialog opens. The selected input event is displayed below the caption.

  6. Select the Write Variable action.

  7. Select the visualization Visudialogs.Keypad in Input type of the implementation of the action.

    The virtual keyboard Visudialogs.Keypad is selected as the input device.

  8. Compile, download, and start the application.

    The visualization opens.

  9. As a visualization user, click the button.

    The virtual keyboard is displayed and allows text input by means of the mouse.

    _visu_img_call_virtual_keypad.png

Configuring numeric input especially for virtual numeric keypads

Requirement: A project with a visualization is open.

  1. Declare an input variable in the PLC_PRG program.

    VAR_INPUT iInput : INT; END_VAR

  2. Open the visualization and add a Rectangle element.

  3. Select the element in the editor.

    The properties are visible in the Properties view.

  4. Configure the Texts → Text property with Number input: %i.

  5. Configure the Text variables → Text variable property with PLC_PRG.iInput.

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

    The Input Configuration dialog opens. The selected input event is displayed below the caption.

  7. There you select the Write Variable action from the list of possible actions and click the _visu_img_add_selected_alarm_group.png symbol.

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

  8. Select the following settings:

    Input type set to VisuDialogs.Numpad.

    Choose variable to edit set to Use text output variable.

    Dialog title set to 'My virtual numpad'.

  9. Click OK to close the dialog.

    The user input is configured.

  10. Compile, download, and start the application.

    The application runs. The visualization opens. When a user clicks the rectangle, the numeric keypad opens.

    _visu_img_call_virtual_numpad.png

Defining default text input

Requirement: A project with a visualization and a user input configuration is open. For all Write Variable follow-up actions, the value Default is selected for the Input type setting.

  1. Double-click the Visualization Manager.

  2. On the Settings tab, in the Default Text Input group, click in the default text input to assign visualizations.

    These visualizations are defined as default text input. If a display variant does not have a keyboard, then these visualizations are called without you having to adapt the user input.