Hello everyone, I am testing this Titanium code:
Titanium.UI.setBackgroundImage("#000"); var tabGroup = Titanium.UI.createTabGroup(); var myWindow = Titanium.UI.createWindow({ title:"Tours", backgroundColor:"#FFFFFF" }); var myTab = Titanium.UI.createTab({ icon:"KS_nav_ui.png", title:"Pays et capitales", window:myWindow }); var myData=[ {title:"First picture",leftImage:"images/pic1.png",className:"tableRow",hasDetail:true,js:"css.js",datatoPass:"Original Data"}, {title:"Second picture",leftImage:"images/pic2.png",className:"tableRow"}, {title:"Third picture",leftImage:"images/pic3.png",className:"tableRow",hasDetail:true}, {title:"Fourth picture",leftImage:"images/pic4.png",className:"tableRow",hasDetail:true}, ]; var myTableView = Titanium.UI.createTableView({ data: myData }); myWindow.add(myTableView); myTableView.addEventListener("click", function(e){ if (e.source.hasDetail){ //Load new window if(e.source.js){ var m = Titanium.UI.createWindow({ title:e.source.title, backgroundColor:"#FFFFFF", dataToPass:e.source.dataToPass, url:e.source.js }); } else{ var m = Titanium.UI.createWindow({ title:e.source.title, backgroundColor:"#FFFFFF", }); var myLabel = Titanium.UI.createLabel({ text:"New label created from the "+e.source.title, width:"auto", height:"auto", textAlign:"center" }); m.add(myLabel); } myTab.open(m,{animated:true}); } else { alert("No window to open :(") } }); tabGroup.add(myWindow); tabGroup.add(myTab); tabGroup.open();The problem is that the application didn't show up... the emulator start but not my application!
what's wrong with it?
thanks in advance!
1 Answer
it didn't work ... :(
I thought that I have made a mistake into the code itself, because I didn't get the application started, here is the code, can anyone tell me what's wrong with it?
Titanium.UI.setBackgroundImage("#000"); var tabGroup = Titanium.UI.createTabGroup(); var myWindow = Titanium.UI.createWindow({ title:"Tours", backgroundColor:"#FFFFFF" }); var myTab = Titanium.UI.createTab({ icon:"KS_nav_ui.png", title:"Pays et capitales", window:myWindow }); var myData=[ {title:"Picture1",leftImage:"images/pic1.png",className:"tableRow",hasDetail:true,js:"css.js",datatoPass:"Original Data"}, {title:"Picture2",leftImage:"images/pic2.png",className:"tableRow"}, {title:"Picture3",leftImage:"images/pic3.png",className:"tableRow",hasDetail:true}, {title:"Picture4",leftImage:"images/pic4.png",className:"tableRow",hasDetail:true}, ]; var myTableView = Titanium.UI.createTableView({ data: myData }); myWindow.add(myTableView); myTableView.addEventListener("click", function(e){ if (e.source.hasDetail){ //Load new window if(e.source.js){ var m = Titanium.UI.createWindow({ title:e.source.title, backgroundColor:"#FFFFFF", dataToPass:e.source.dataToPass, url:e.source.js }); } else{ var m = Titanium.UI.createWindow({ title:e.source.title, backgroundColor:"#FFFFFF", }); var myLabel = Titanium.UI.createLabel({ text:"New label created from the "+e.source.title, width:"auto", height:"auto", textAlign:"center" }); m.add(myLabel); } myTab.open(m,{animated:true}); } else { alert("No window to open :(") } }); myWindow.add(myTableView); tabGroup.add(myTab); tabGroup.open();Thanks
Your Answer
Think you can help? Login to answer this question!