Is Ti.UI.currentWindow Broken?

You must Login before you can answer or comment on any questions.

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

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.

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'

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

Your Answer

Think you can help? Login to answer this question!