Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Is Ti.UI.currentWindow Broken?

I can't get it to work at all.

Also there is no reference to it in the api docs.

function GetLabelRef()
{
return Titanium.UI.currentWIndow.MyLabel;
}

I am using 1.1

— asked March 24th 2010 by Darren Stuart
  • currentwindow
  • iphone
  • window
0 Comments

3 Answers

  • This unfortunately doesn't work on Android platform, when trying this:

    var win = Ti.UI.createWindow({url:'bar.js'});
    
    win.fun = function(){ /* do something */ };
    

    while in bar.js:

    Ti.UI.currentWindow.fun() // bad things happen on android here
    

    Thx.

    — answered March 24th 2010 by Martin Lasak
    permalink
    0 Comments
  • what is MyLabel? the only way that will work is if you set a MyLabel property on the window. For example:

    
    var win = Ti.UI.createWindow({url:'bar.js'});
    
    win.myLabel = 'foo';
    

    then in bar.js, you can do:

    
    Ti.UI.currentWindow.myLabel // this will be 'foo'
    
    — answered March 24th 2010 by Nolan Wright
    permalink
    0 Comments
  • var TitleLabel = Ti.UI.createLabel({color:'#fff', top:'7px', left:'20px', height:'auto', text:'Some text' ,font:{fontSize:16, fontWeight:'bold'}});

    win1.MyLabel = tickerLabel

    thats how I am setting it up, I think the issue is I can't reference a control this way.

    I am trying to solve this question http://developer.appcelerator.com/question/5891/getting-a-controls-value#14201

    — answered March 24th 2010 by Darren Stuart
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.