Focus HMI Script Value Entry

In Focus HMI panels, there are situations where the on-screen keyboard is not called when entering values to labels.

The simplest example of this is that the on-screen keyboard does not work in the simulation of Focus HMI, while the on-screen keyboard works in the Runtime in your project file.

In these and similar cases, you can use scripts to enter values for tags.

import java.lang.reflect.Method;

public class NewScript{
public static short Tag_1;

public NewScript(Class Accessing){
        Method InputBox = Accessing.getMethod("InputBox", String.class, Object.class, String.class);
        Tag_1 = (short) InputBox.invoke(Accessing, "Please enter a value.", Tag_1, "Uint8");

    }catch(Exception exp){
        javax.swing.JOptionPane.showMessageDialog(null , exp.getMessage());

With this script, we call an InputBox in our Focus HMI panel and print the value we will write to the Tag_1 tag.

When creating the script, we need to make sure that we are typing the types of the tag we add correctly.

When you run this script with the help of a button you created, InputBox will appear on your screen. In this way, you will be able to enter values with the on-screen keyboard. It will transfer the value you enter here to Tag_1 tag.

Leave a Reply