Get Started
Plugins
Macros
More information

InputHelper object

Description

Defines the auxiliary window.Asc.plugin.InputHelper object which represents the input helper properties.

Methods and properties:
  • createWindow - the function called to create an input helper window.

    Example
    window.Asc.plugin.init = function(text) {
        if (!window.isInit) {
            window.isInit = true;
            window.Asc.plugin.currentText = "";
            window.Asc.plugin.createInputHelper();
            window.Asc.plugin.getInputHelper().createWindow();
        }
    };
    
  • getItems - the function called to return the InputHelperItem object that contains all the items from the input helper.

    Example
    function getInputHelperSize () {
        var _size = window.Asc.plugin.getInputHelper().getScrollSizes();
        var _width = 150;
        var _height = _size.h;
        var _heightMin = window.Asc.plugin.getInputHelper().getItemsHeight(Math.min(5, window.Asc.plugin.getInputHelper().getItems().length));
        if (_width > 400)
            _width = 400;
        if (_height > _heightMin)
            _height = _heightMin;
            _width += 30;
            return { w: _width, h : _height };
    }
    
  • getScrollSizes - the function called to get the sizes of the input helper scrolled window. Returns an object with width and height parameters.

    Example
    function getInputHelperSize () {
        var _size = window.Asc.plugin.getInputHelper().getScrollSizes();
        var _width = 200;
        var _height = _size.h;
        var _heightMin = window.Asc.plugin.getInputHelper().getItemsHeight(Math.min(5, window.Asc.plugin.getInputHelper().getItems().length));
        if (_width > 400)
            _width = 400;
        if (_height > _heightMin)
            _height = _heightMin;
            _width += 30;
            return { w: _width, h : _height };
    }                                         
    
  • setItems - the function called to set the items to the input helper.

    Parameters
    Parameter Description Type
    InputHelperItem Defines the object which contains all the items for the input helper. This object can have the following parameters:
    • id - the item index,
      type: string,
      example: "1";
    • text - the item text,
      type: string,
      example: "name".
    object
    Example
    {
        var items = [
            { text: "Name1.Family1", id : "0" },
            { text: "Name2.Family2", id : "1" },
            { text: "Name3.Family3", id : "2" },
            { text: "Name4.Family4", id : "3" },
            { text: "Name5.Family5", id : "4" },
            { text: "Name6.Family6", id : "5" },
            { text: "Name7.Family7", id : "6" },
            { text: "Name8.Family8", id : "7" },
            { text: "Name9.Family9", id : "8" },
            { text: "Name10.Family10", id : "9" },
            { text: "Name11.Family11", id : "10" },
            { text: "Name12.Family12", id : "11" },
            { text: "Name13.Family13", id : "12" }
        ];
        window.Asc.plugin.getInputHelper().setItems(items);
        var _sizes = getInputHelperSize();
        window.Asc.plugin.getInputHelper().show(_sizes.w, _sizes.h, true);
    }              
    
  • show - the function called to show an input helper.

    Parameters
    Parameter Description Type
    width The input helper window width measured in millimeters. number
    height The input helper window height measured in millimeters. number
    isCaptureKeyboard Defines if the keyboard is caught (true) or not (false). boolean
    Example
    {
        var items = [
            { text: "Name1.Family1", id : "0" },
            { text: "Name2.Family2", id : "1" },
            { text: "Name3.Family3", id : "2" },
            { text: "Name4.Family4", id : "3" },
            { text: "Name5.Family5", id : "4" },
            { text: "Name6.Family6", id : "5" },
            { text: "Name7.Family7", id : "6" },
            { text: "Name8.Family8", id : "7" },
            { text: "Name9.Family9", id : "8" },
            { text: "Name10.Family10", id : "9" },
            { text: "Name11.Family11", id : "10" },
            { text: "Name12.Family12", id : "11" },
            { text: "Name13.Family13", id : "12" }
        ];
        window.Asc.plugin.getInputHelper().setItems(items);
        var _sizes = getInputHelperSize();
        window.Asc.plugin.getInputHelper().show(_sizes.w, _sizes.h, true);
    }                                                   
    
  • unShow - the function called to hide an input helper.

    Example
    window.Asc.plugin.executeMethod ("SelectContentControl", [window.Asc.plugin.currentContentControl.InternalId], function() {
        window.Asc.plugin.executeMethod("InputText", [item.text]);
        window.Asc.plugin.getInputHelper().unShow(); 
    });