on different buttons click the respective window is added to same view.For first time on all button clicks successful windows are added but when again clicked on same buttons the window fails to get added to that same view.(trying to make as tabbar functionality).
var win = Ti.UI.currentWindow;
(function(){
var buttonGroupView = Ti.UI.createView({
backgroundColor:'#ccc'});
var diffScreenView=Ti.UI.createView({
backgroundColor:'#660000',
top:'10%',
height:'70%',
});
var win1 = Titanium.UI.createWindow({
alert:'In Tab 1 Selected',
title:'Tab 1',
backgroundColor:'#eee'
});
var win2 = Titanium.UI.createWindow({
alert:'In Tab 2 Selected',
title:'Tab 2',
backgroundColor:'#CC6666'
});
var win3 = Titanium.UI.createWindow({
alert:'In Tab 3 Selected',
title:'Tab 3',
backgroundColor:'#FFFF33'
});
var barView = Ti.UI.createView({
backgroundColor: 'transparent',
layout: 'horizontal',
bottom:0,
height:40 });
var button1 = Ti.UI.createButton({ title: 'Button 1', bottom:0, });
var button2 = Ti.UI.createButton({ title: 'Button 2', bottom:0, }); var button3 = Ti.UI.createButton({ title: 'Button 3', bottom:0, });
button1.addEventListener('click', function(e) {
alert('clicked1');
diffScreenView.add(win1);
diffScreenView.show();
});
button2.addEventListener('click', function(e) {
alert('clicked2');
diffScreenView.add(win2);
diffScreenView.show();
});
button3.addEventListener('click', function(e) {
alert('clicked3');
diffScreenView.add(win3);
diffScreenView.show();
});
buttonGroupView.add(diffScreenView); barView.add(button1); barView.add(button2); barView.add(button3);
buttonGroupView.add(barView);
win.add(buttonGroupView);
})();
Is it the case,that it is not running well on my side only?? waiting for perfect solution soon.
1 Answer
Hi Ishwari,
Window is parent Object so you can not add window in view.You can add View in window.
Your Answer
Think you can help? Login to answer this question!