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

1

5

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?

Cetane answered 15/9, 2012 at 11:11 Comment(2)
I guess you are missing Utils.jsJuliennejuliet
I can't find a Utils.js in the commonlib folderof the emulator, do you know what the full path is?Cetane
C
8

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.

Cetane answered 15/9, 2012 at 13:0 Comment(1)
Does anyone know if this has to be used on the initial index.html page only? I can't seem to get it to work.Limitless

© 2022 - 2024 — McMap. All rights reserved.