Open virtual keypads by JavaScript

I want to open the virtual numeric keypad, when pressing a button. I do not want to use a input field because of design issues. Can anybody provide an example for both keypads: - numeric keypad (for interger and float) - textual keypad (for text) I'm not able to find this information in the documentation.
Best reply by HmiGuide

Define a UI Action with a parameter ItemName (parameters[0]) and call shmi.numpad(p).

(function() {
    var actions = shmi.pkg("visuals.session.userActions"); //get reference to userActions object
    actions["_Open-NumPad"] = function(parameters) {
    const im = shmi.visuals.session.ItemManager;
    oVal = im.readValue(params[0]);
    if (oVal===null) {
        alert(params[0] + " item not defined");
    } else {
        let p = {
            unit:      "",   // unit for display
            label:     "",   // label for display
            value:     oVal, // initial value for edit
            callback:  function(value) {
                im.writeValue(p.item, value);
            },
            min:       0,    // min. value
            max:       100,  // max. value
            type:      2,    // 2=INT 3=REAL
            precision: 2,    // number of digits
            item:      parameters[0]  // item name e.g. "SInt"
        };
        shmi.numpad(p);
    }   
    };
}());
ย 

ย 

View original
3 replies