Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1535] Android: TabGroup focus event args refer to previous tab, not current tab

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2011-04-15T02:55:21.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M05
ComponentsAndroid
Labelsandroid, defect, tabGroup, tabgroup
ReporterBill Dawson
AssigneeDon Thorp
Created2011-04-15T02:55:20.000+0000
Updated2017-03-03T05:58:20.000+0000

Description

Also, tabGroup.activeTab.title returns undefined.

Test case:


Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();

for (var i = 0; i < 4; i++) {
    var win = Ti.UI.createWindow({
        title: 'Tab ' + i,
        backgroundColor: '#fff'
    });
    var tab = Ti.UI.createTab({
        title: 'Tab ' + i,
        window: win
    });
    tabGroup.addTab(tab);
}

tabGroup.addEventListener('focus', function(e) {
    Ti.API.info('index: ' + e.index);
    Ti.API.info('previousIndex: ' + e.previousIndex);
    Ti.API.info('previousTab.title: ' + e.previousTab.title);
    Ti.API.info('tab.title: ' + e.tab.title);
    Ti.API.info('tabGroup.activeTab.title: ' + tabGroup.activeTab.title);
});
        
tabGroup.open();

After the app launches, click Tab 1 and you'll see the info output in the console refers to Tab 0.

Comments

  1. Marshall Culpepper 2011-04-15

    This looks to be a duplicate of #2071, which should now be resolved (minus the setActiveTab bug which I'll be merging the fix for soon)

  2. Lee Morris 2017-03-03

    Closing issue due to time passed and irrelevance of the ticket.

JSON Source