Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a text input to a Samsung Smart TV app?

I'm trying to add a text box to an app for Samsung Smart TV. I'm following Samsungs dev guidelines but the following fails because IMEShell is undefined.

new IMEShell(this._INPUT_ID, this._imeReady.bind(this), "en");

I have the following in the index.html file:

<script type="text/javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<script type="text/javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>

What script file do I need to include to get access to IMEShell?

like image 494
slashnick Avatar asked Sep 15 '12 11:09

slashnick


1 Answers

Ok, so it turns out there are two ways of using input in the Smart TV app depending on which type of project you are using. If you are creating an AppFramework project you need to have ime listed as a module in the app.json at the root of the project:

{
    "theme" : "base",
    "languages" : ["en"],
    "resolutions": ["540p", "720p", "1080p"],
    "modules" : ["ime"]
}

Then you need to include the AppFramework script in the index.html of your project:

<script type="text/javascript" src="$MANAGER_WIDGET/Common/af/2.0.0/loader.js"></script>

Alternatively you can create a javascript project which doesn't use the AppFramewrok code and doesn't require that the project be split into 'scenes'. In this case there are a large number of scripts that need to be included:

  <!-- Common API -->
  <!--  Taken from http://www.samsungdforum.com/SamsungDForum/ForumView/df3455b529adf7c4?forumID=8c1afcc0709c2097 -->
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/OpenSrc/jquery-1.4.2.min.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/API/Plugin.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/Util/Include.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/Util/Language.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/Plugin/Define.js"></script>
  <script type="text/javascript" src="$MANAGER_WIDGET/Common/IME/ime2.js"></script>

This will create a numeric keypad; to create a QWERTY keyboard add the following script within the body tag.

  <script type="text/javascript" src="$MANAGER_WIDGET/Common/IME_XT9/ime.js"></script>

There is an example of this on the Samsung Forum.

Once the scripts have been included by one of these methods the rest of the input control docs should work.

like image 128
slashnick Avatar answered Oct 29 '22 19:10

slashnick