0% found this document useful (0 votes)
60 views2 pages

LG Virtual Keyboard User Guide

The virtual keyboard library allows developers to easily include a virtual keyboard in their applications to receive text input on smart TVs. The library handles displaying the keyboard and passing keyboard events to the application. Developers can customize keyboard appearance and behavior by overriding methods for keyboard show, hide, and key events.

Uploaded by

TheCodeTime Time
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

LG Virtual Keyboard User Guide

The virtual keyboard library allows developers to easily include a virtual keyboard in their applications to receive text input on smart TVs. The library handles displaying the keyboard and passing keyboard events to the application. Developers can customize keyboard appearance and behavior by overriding methods for keyboard show, hide, and key events.

Uploaded by

TheCodeTime Time
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Virtual Keyboard

Virtual Keyboard is designed to appear as below when a text input element is focused. Developers can easily use
virtual keyboard by including virtual keyboard library.

USB keyboard input and Voice Recognition are supported since NetCast 3.0(2012).

To download the Virtual Keyboard Library, go to [Resource Center > Smart TV > SDK & Tools > Sample
Codes] menu in LG Developer (http://developer.lge.com) website.

Using Virtual Keyboard Library


To use the virtual keyboard, add the following script in the head of html file. In order to use virtual keyboard in
iframes, it should be added in the html file connected to the iframe.
(Relative path of the jsLgVKeyboard folder should be modified according to the real path.)

In a normal or parent page


<link type="text/css" rel="Stylesheet" href="../jsLgVKeyboard/LgVKeyboard.css" />
<script id="mainVKScript" type="text/javascript"
src="../jsLgVKeyboard/LgVKeyboard.js"></script>

In iframe pages
<script type="text/javascript"
src="../jsLgVKeyboard/LgVKeyboardIframe.js"></script>

As Virtual Keyboard uses keydown and keyup events, use the lgKb.onKeyDown and lgKb.onKeyUp methods as
below to use keydown event in the application instead of setting handler of window.onkeydown event.

<script>
function onKeyDown(event) {
var keyCode = event.keyCode;
switch(keyCode) {
case VK_LEFT :
...
break;
case VK_RIGHT :
...
break;
...
}
}

function onKeyUp(event) {
var keyCode = event.keyCode;
switch(keyCode) {
case VK_LEFT :
...
break;
case VK_RIGHT :
...
break;
...
}
}

lgKb.onKeyDown = onKeyDown;
lgKb.onKeyUp = onKeyUp;

</script>

Virtual Keyboard library calls lgKb.onKeyboardShow or lgKb.onKeyboardHide methods after Virtual Keyboard
appear or disappear. Override the lgKb.onKeyboardShow and lgKb.onKeyboardHide methods as below for
additional task.

<script>
function onKeyboardShow(event) {
...
}

function onKeyboardHide(event) {
...
}

lgKb.onKeyboardShow = onKeyboardShow;
lgKb.onKeyboardHide = onKeyboardHide;

</script>

• Do not modify the folder structure and file name of jsLgVKeyboard.


• The script must include the following declaration: id = “mainVKScript”
• A web page should be set character set as UTF-8 to use virtual keyboard as following:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

• Virtual keyboard is enabled in the following tag/types:

Tag Type

INPUT TEXT

INPUT PASSWORD

TEXTAREA

• Beware of cross-domain problem when using iframe. If an application uses multiple html files those are loaded
from different domains, cross-domain problem occurs and virtual keyboard cannot be used in iframe.

Supported Language
Virtual keyboard supports 42 languages, and 16 languages are supported for voice recognition of them.
Refer to Developing > API > Voice Recognition Plugin and API section in this Library for detailed information.

You might also like