Skip to content

Legacy API: IME

Dayoung Kim edited this page Jan 8, 2016 · 4 revisions

For converting IME of Legacy to TOAST API, please refer to the followings.

  • Before

    function onKeyCallback(key, str, id) {
        switch(key){
            case 29443: // ENTER
                ...
                onBlur();
                break;
            case 88: // RETURN
            case 45: // EXIT
                ...
                onBlur();
                break;
        }
    }
    
    var imeBox = new IMEShell_Common();
    imeBox.inputboxID = 'searchText1';
    imeBox.inputTitle = 'Common Input Title1';
    imeBox.onCompleteFunc = onCompleteText;
    imeBox.onKeyPressFunc = onKeyCallback;
    imeBox.context = this;
    imeBox.setBlockSpace(true);
    
    document.getElementById('searchText').focus(); // 'serchText' : id of input tag
    imeBox.onShow();
  • After

    imeEle = document.getElementById('searchText'); // 'serchText' : id of input tag
    
    imeEle.addEventListener('submit', function (e) {
        console.log("The DONE button of IME is pushed");
    });
    
    imeEle.addEventListener('cancel', function (e) {
        console.log("The CANCEL button of IME is pushed");
    });
    
    imeEle.addEventListener('blur', function (e) {
        console.log("The INPUT element loses focus");
    
        if(imeEle.getAttribute('data-ime-show') == 'false') {
            console.log("The IME is closed");
        }
    
    });
    imeEle.focus();
Clone this wiki locally