最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I add a text input to a Samsung Smart TV app? - Stack Overflow

programmeradmin1浏览0评论

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?

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?

Share Improve this question asked Sep 15, 2012 at 11:11 slashnickslashnick 26.6k10 gold badges57 silver badges68 bronze badges 2
  • I guess you are missing Utils.js – Kundan Singh Chouhan Commented Sep 15, 2012 at 11:18
  • I can't find a Utils.js in the monlib folderof the emulator, do you know what the full path is? – slashnick Commented Sep 15, 2012 at 11:26
Add a ment  | 

1 Answer 1

Reset to default 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./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.

发布评论

评论列表(0)

  1. 暂无评论