[TIMOB-3628] Android: setActiveTab does not switch tabs if child window opened in tab
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-04-19T18:54:35.000+0000 |
Affected Version/s | Release 1.6.0 |
Fix Version/s | n/a |
Components | Android |
Labels | 1.6.1, android, rplist, setactivetab, tabGroup |
Reporter | Jon Alter |
Assignee | Don Thorp |
Created | 2011-04-19T18:24:31.000+0000 |
Updated | 2017-03-09T23:18:44.000+0000 |
Description
If you open a window inside of a tab and then call setActiveTab, the tab switches as it should behind the open window. You never see this because the open window is not hidden in the process. This can be seen in KitchenSink 'Base UI'>'Tab Groups'>'Set Active Tab(either)'.
Step 1: run the code below
Step 2: click the 'Open Child Window' button
Step 3: click the 'Tab 2' button
Step 4: notice that nothing happens
Step 5: hit the back button
Step 6: notice that the tab is changed
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var button1 = Ti.UI.createButton({
title: 'Open child window'
});
button1.addEventListener('click', function(e){
childWin = Titanium.UI.createWindow({
title:'Tab 1 Child',
backgroundColor:'#fff'
});
var button2 = Ti.UI.createButton({
title: 'Tab 2'
});
button2.addEventListener('click', function(e){
tabGroup.setActiveTab(tab2);
});
childWin.add(button2);
Titanium.UI.currentTab.open(childWin,{animated:true});
});
win1.add(button1);
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
Workaround
If you close the open window(s) when you setActiveTab it will act as expected.This is default android behavior. You must close the open window when you setActiveTab.
Closing ticket as invalid.