0

Widget freezes in loading state

hi everyione.
I'm a newbie trying to learn here. I wrote a simple Hello world application based on "SampleVideo" widget that displays text in the Text element of the sidebarview. Now i'm trying to randomly change the text on each timer tick. I setup a timer like follow in createView:

var myTimer = KONtx.utility.timer.setInterval(this._test, 5000);

and have _test routine:

_test: function() {
print("######## Timer Fired");
}

Problem when i run this code my widget freezes in "loading" state and the below message appear in the Terminal window If i comment out timer and _test routine, everything works perfectly. I checked init.js file and it has the following line in it:

settingsViewId: 'view-Settings',

WM 00:00:09:876: [T:3872] [KONtx/HelloWorld] {HostEventManager} :: Got HostEvent: onAppInit
TV 00:00:09:877: [T:3872] NETWORK INTERFACE TV Network Type STATUS = 0
WM 00:00:09:877: [T:3872] Network status: up
WM 00:00:09:877: [T:3872] WARNING!
WM 00:00:09:877: [T:3872] WARNING!
WM 00:00:09:877: [T:3872] You didn't provide a settingsViewId in your app init. It's not supported to have a widget without a settings view. Not providing this will likely cause your widget to be blocked from being in the gallery.
WM 00:00:09:877: [T:3872] WARNING!
WM 00:00:09:877: [T:3872] WARNING!

Appreciate any help

Stan

by
6 Replies
  • never mind, newbie error... Another question so:

    Text element declared in createView:

    this.controls.qTxt = new KONtx.element.Text({...}).appendTo(this);
    and passed as reference to timer:
    var myTimer = KONtx.utility.timer.setInterval(this._timerFired, 6000,this.controls.qTxt);
    Callback function as follow:
    _timerFired: function(TextControl) {
    TextControl.setText("random text");
    }

    error in terminal:
    WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WE 00:00:26:865: [T:8137] ERROR!ERROR!ERROR!ERROR!ERROR!
    WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WE 00:00:26:865: [T:8137] HelloWorld [com.kgb.widgets.tv.helloworld]
    WE 00:00:26:865: [T:8137] TypeError: TextControl.setText is not a function (sidebar.js: Line 156)
    WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    When i print TextControl it shows up as [object DOMEvent]

    What am i doing wrong?

    Thanks
    0
  • QUOTE (Stan @ Feb 23 2010, 11:31 AM) <{POST_SNAPBACK}>
    never mind, newbie error... Another question so:

    Text element declared in createView:

    this.controls.qTxt = new KONtx.element.Text({...}).appendTo(this);
    and passed as reference to timer:
    var myTimer = KONtx.utility.timer.setInterval(this._timerFired, 6000,this.controls.qTxt);
    Callback function as follow:
    _timerFired: function(TextControl) {
    TextControl.setText("random text");
    }

    error in terminal:
    WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WE 00:00:26:865: [T:8137] ERROR!ERROR!ERROR!ERROR!ERROR!
    WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WE 00:00:26:865: [T:8137] HelloWorld [com.kgb.widgets.tv.helloworld]
    WE 00:00:26:865: [T:8137] TypeError: TextControl.setText is not a function (sidebar.js: Line 156)
    WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    When i print TextControl it shows up as [object DOMEvent]

    What am i doing wrong?

    Thanks

    You can't pass in an arbitrary argument like that. The argument TextControl in the callback is an event object, not the Text object.

    I don't use timers much, but can you just refer to the this.controls.qTxt in the callback? I'm not sure what scope the callback executes in.
    0
  • It looks like "this" refers to global scope in a callback. This article should help: http://killustar.blogspot.com/2005/04/java...al-problem.html
    0
  • QUOTE (Steve @ Feb 23 2010, 11:43 AM) <{POST_SNAPBACK}>
    You can't pass in an arbitrary argument like that. The argument TextControl in the callback is an event object, not the Text object.

    I don't use timers much, but can you just refer to the this.controls.qTxt in the callback? I'm not sure what scope the callback executes in.


    Tried that and recieve the same error: "TypeError: this.controls has no properties". I was basing the code on this thread (just they using grid control) but looks like i'm missing some understanding http://developer.yahoo.net/forum/index.php...hl=onTimerFired

    If i decalre qTxt as var, i have problems accessing it in updateView... so, i'm stuck for now...
    0
  • Try this:
    CODE
    this.controls.qTxt = new KONtx.element.Text({...}).appendTo(this);
    and passed as reference to timer:
    var self = this;
    var myTimer = KONtx.utility.timer.setInterval(this._timerFired, 6000,self.controls.qTxt);
    Callback function as follow:
    _timerFired: function(TextControl) {
    TextControl.setText("random text");
    }
    0
  • I&#39;m a newbie getting the same error. Do you mind posting the fix to help the rest of us? Thanks<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Stan @ 23 Feb 2010 10:02 AM)</cite><blockquote class="quotemain">hi everyione.<br>I&#39;m a newbie trying to learn here. I wrote a simple Hello world application based on &quot;SampleVideo&quot; widget that displays text in the Text element of the sidebarview. Now i&#39;m trying to randomly change the text on each timer tick. I setup a timer like follow in createView:<br><br>var myTimer = KONtx.utility.timer.setInterval(this._test, 5000);<br><br>and have _test routine:<br><br>_test: function() {<br> print(&quot;######## Timer Fired&quot;); <br>}<br><br>Problem when i run this code my widget freezes in &quot;loading&quot; state and the below message appear in the Terminal window If i comment out timer and _test routine, everything works perfectly. I checked init.js file and it has the following line in it:<br><br>settingsViewId: &#39;view-Settings&#39;, <br><br>WM 00:00:09:876: [T:3872] [KONtx/HelloWorld] {HostEventManager} :: Got HostEvent: onAppInit<br>TV 00:00:09:877: [T:3872] NETWORK INTERFACE TV Network Type STATUS = 0<br>WM 00:00:09:877: [T:3872] Network status: up<br>WM 00:00:09:877: [T:3872] WARNING!<br>WM 00:00:09:877: [T:3872] WARNING!<br>WM 00:00:09:877: [T:3872] You didn&#39;t provide a settingsViewId in your app init. It&#39;s not supported to have a widget without a settings view. Not providing this will likely cause your widget to be blocked from being in the gallery.<br>WM 00:00:09:877: [T:3872] WARNING!<br>WM 00:00:09:877: [T:3872] WARNING!<br><br>Appreciate any help<br><br>Stan</blockquote></div></div>
    0

Recent Posts

in General - Yahoo! TV Widgets