簡體   English   中英

三星智能電視IME無法聚焦

[英]Samsung smart TV IME not focusing

當我嘗試運行代碼時,整個屏幕模糊不清,當我按UP / DOWN鍵時,控制台顯示IME input key skip and call event.preventDefault(), event.stopPropagation()

我的部分代碼:

HTML:

<body onLoad="func_onLoad()" onunload="func_onUnload()">
    <input id="username" type="text" onkeydown="onkeydown_input(this)" class="input username" placeholder="Username" required/>
    <input id="password" type="password" onkeydown="onkeydown_input(this)" class="input password" placeholder="Password" required/>
</body> 

ime.js:

var username = null;
var password = null;
var currentIMEObj = null;

function func_onLoad(){
alert("func_onLoad begin...");

username = new IMEShell_Common();
username.inputboxID = "username";
username.inputTitle = "username";
username.inputDescription = "Please enter your username";
username.onKeyPressFunc = onKeyCallback_username;
username.context = this;
username.setBlockSpace(true);

password = new IMEShell_Common();
password.inputboxID = "password";
password.inputTitle = "password";
password.inputDescription = "Please enter your password";
password.onKeyPressFunc = onKeyCallback_password;
password.context = this;
password.setBlockSpace(true);

document.getElementById("username").focus();
username.onShow();
}


function func_onUnload() {
alert("func_onUnload begin...");
if(username)
    username.onClose();
if(password)
    password.onClose();
}

function onkeydown_input(obj){
alert("onkeydown_input");
var EKC = event.keyCode;

switch(EKC){
    case(29460)://Up key
        if(obj.id == "username"){
            document.getElementById("username").blur();
            username.onClose();
        }
        else if(obj.id == "password"){
            document.getElementById("username").focus();
            username.onShow();
            currentIMEObj = username;
        }
    break;

    case(29461)://Down key
        if(obj.id == "username"){
            document.getElementById("password").focus();
            password.onShow();  
            currentIMEObj = password;
        }
        else if(obj.id == "password"){
            document.getElementById("password").blur();
            password.onClose();
        }
    break;

    case(29443)://Enter key
        if(obj.id == "username"){
            username.onShow();
            currentIMEObj = username;
        }
        else if(obj.id == "password"){
            password.onShow();
            currentIMEObj = password;
        }
    break;

    case(88)://return
    break;

    case(45)://exit   
        return;
    break;
}
}

function onKeyCallback_username(key,str,id) {
alert("CALLBACK onKeyCallback ===================: " + key + " ID = " + id + " STR = " + str);
switch (key) {
    case (29443): // Enter Key
        alert("ENTER");
        break;
    case (88):  //return
        alert("RETURN");
        break;
    case (45):  //exit
        alert("EXIT");
        break;
}
}


function onKeyCallback_password(key,str,id) {
alert("CALLBACK onKeyCallback ===================: " + key + " ID = " + id + " STR = " + str);
switch (key) {
    case (29443): // Enter Key
        alert("ENTER");
        break;
    case (88):  //return
        alert("RETURN");
        break;
    case (45):  //exit
        alert("EXIT");
        break;
}
}

任何人都知道為什么即使有document.getElementById("username").focus();也不關注document.getElementById("username").focus(); 在func_onLoad()方法中,以及為什么調用event.preventDefault()

任何幫助表示贊賞!!! 提前致謝!!!

是的,我們在開發中也遇到了類似的問題。 如果您獨立處理應用程序中的焦點,則會出現問題。 因此,如果您的應用程序使用獨立的框架來處理切換焦點和活動狀態,則IME將無法工作,因為它將與您自己的應用程序的焦點沖突。 唯一的解決方案是創建自己的IME。

我不明白為什么會出現問題,但我認為安德里亞-f的答案不太正確。 您的代碼正常。 我知道,因為我有同樣的問題。 我認為問題出在模擬器上。

我已經編寫了與您非常相似的代碼,並且遇到了與您相同的問題(相同的錯誤,屏幕變暗等),但是當我在真實設備(我的Samsung Smart F6400)上測試該應用程序時完美。

在真實設備上嘗試您的應用。 那是我對你的建議。

祝好運!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM