Back button key not working properly

Back button key not working properly

Postby priya » Wed Dec 04, 2013 11:18 pm

In my app i am using the built-in keyboard . When i included the library for in-built keyboard back button is not working properly but it is working fine when i remove keyboard.js from my html.
priya
 
Posts: 16
Joined: Sun Aug 25, 2013 10:53 pm

Back button key not working properly

Postby priya » Wed Dec 04, 2013 11:18 pm

In my app i am using the built-in keyboard . When i included the library for in-built keyboard back button is not working properly but it is working fine when i remove keyboard.js from my html.
priya
 
Posts: 16
Joined: Sun Aug 25, 2013 10:53 pm

Re: Back button key not working properly

Postby Support_STA » Wed Dec 04, 2013 11:18 pm

Hello Priya,

Can you please be a bit more specific about the problem? For instance describe what you see happening.

Thank you.
STA QA
Support_STA
 
Posts: 136
Joined: Fri Aug 09, 2013 3:56 am

Re: Back button key not working properly

Postby priya » Wed Dec 04, 2013 11:18 pm

The js file which i included in my app are as follows:






when i press the back button it is not recognizing the back button code it is going to the default key. i checked like this:
case VK_BACK:
alert(\"display screen\"+display_screen);
break;
default:
alert(\"default key\");
break;
Then i tried by removing some of the js files. i included the follwing js file oly and i checked





When i tried with these js the back button worked poperly. I cant able to identity where it is going wrong. Can you help me in this
priya
 
Posts: 16
Joined: Sun Aug 25, 2013 10:53 pm

Re: Back button key not working properly

Postby Support_STA » Wed Dec 04, 2013 11:18 pm

For this LG on-screen keyboard to work you just need two JavaScript files:




Note that the order of the scripts is important and smarttv_getplatform must be loaded first. You can omit the LGVKeyboard.css stylesheet. Keyboard.js will take case of loading all necessary JS and CSS files when running on the LG platform. Please change the file locations in keyboard.js if necessary. Once you have this every text on your page will activete the on-screen keyboard when focused.

To get your own key event handler working alongside the keyboard you should comment or remove the following lines in keyboard.js:

else
{
// you can use your own event handler - keyboard is built-in -> rename 'onkeydownhandler' to your keydown event handler
document.addEventListener(\"onkeydown\", onkeydownhandler, true);
}

Assuming you already define your own keydown event handler in the onload of your page you should now be able to catch the VK_BACK key code when you press the back key.

Extra note: TV browsers do not necessarily support 'alert()' in javascript, please do not use it.

Best regards,
STA QA
Support_STA
 
Posts: 136
Joined: Fri Aug 09, 2013 3:56 am

Re: Back button key not working properly

Postby Support_STA » Thu Dec 05, 2013 12:23 am

Hello Priya,

Can you please be a bit more specific about the problem? For instance describe what you see happening.

Thank you.
STA QA
Support_STA
 
Posts: 136
Joined: Fri Aug 09, 2013 3:56 am

Re: Back button key not working properly

Postby priya » Thu Dec 05, 2013 3:33 am

The js file which i included in my app are as follows:
<script type="text/javascript" src="javascript/smarttv_getplatform.js"></script>
<script type="text/javascipt" src="javascript/lg_keyconstants.js"></script>
<link rel="stylesheet" type="text/css" href="javascript/jslgVKeyboard/LgVKeyboard.css" />
<script type="text/javascript" id="mainVKScript" src="javascript/jslgVKeyboard/LgVKeyboard.js"></script>
<script type="text/javascript" src="javascript/keyboard.js"></script>

when i press the back button it is not recognizing the back button code it is going to the default key. i checked like this:
case VK_BACK:
alert("display screen"+display_screen);
break;
default:
alert("default key");
break;
Then i tried by removing some of the js files. i included the follwing js file oly and i checked

<script type="text/javascript" src="javascript/smarttv_getplatform.js"></script>
<script type="text/javascipt" src="javascript/lg_keyconstants.js"></script>


When i tried with these js the back button worked poperly. I cant able to identity where it is going wrong. Can you help me in this
priya
 
Posts: 16
Joined: Sun Aug 25, 2013 10:53 pm

Re: Back button key not working properly

Postby Support_STA » Thu Dec 05, 2013 4:32 am

For this LG on-screen keyboard to work you just need two JavaScript files:

<script type="text/javascript" src="smarttv_getplatform.js"></script>
<script type="text/javascript" src="keyboard.js"></script>

Note that the order of the scripts is important and smarttv_getplatform must be loaded first. You can omit the LGVKeyboard.css stylesheet. Keyboard.js will take case of loading all necessary JS and CSS files when running on the LG platform. Please change the file locations in keyboard.js if necessary. Once you have this every text <input> on your page will activete the on-screen keyboard when focused.

To get your own key event handler working alongside the keyboard you should comment or remove the following lines in keyboard.js:

else
{
// you can use your own event handler - keyboard is built-in -> rename 'onkeydownhandler' to your keydown event handler
document.addEventListener("onkeydown", onkeydownhandler, true);
}

Assuming you already define your own keydown event handler in the onload of your page you should now be able to catch the VK_BACK key code when you press the back key.

Extra note: TV browsers do not necessarily support 'alert()' in javascript, please do not use it.

Best regards,
STA QA
Support_STA
 
Posts: 136
Joined: Fri Aug 09, 2013 3:56 am


Return to App development questions



cron