Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9444] Android: Ti.UI.Tab.open() should not set the window property

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-01T12:38:39.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 3.0.2
ComponentsAndroid
Labelsapi, parity
ReporterDavide Cassenti
AssigneeShameer Jan
Created2012-06-07T11:26:56.000+0000
Updated2017-03-27T18:30:34.000+0000

Description

Problem description

When calling the open() method of a Ti.UI.Tab object, the window property is set to be the new open window. This does not happen on iOS and, based on the documentation, it is wrong; the doc explains, in fact, that "window" is the "Root level tab window."

Steps to reproduce

1. create a new app with the following code 2. click on 'get active tab window title' button: it displays 'Win 1' 3. click on 'Open subwindow': a new window is open, replacing the tabgroup as explained in the docs 4. click back, and press again 'get active tab window title': the alert now displays 'Win 1a', which is not the right one.
var tabGroup = Ti.UI.createTabGroup();

var win1 = Ti.UI.createWindow ({
    title: "Win 1",
    layout: "vertical"
});

var btn1 = Ti.UI.createButton ({
    title: 'Open subwindow',
    top: 20
});

btn1.addEventListener ('click', function (e) {
    var win1a = Ti.UI.createWindow ({
        title: "Win 1a"
    });
    tabGroup.getActiveTab().open (win1a);
});

win1.add (btn1);

var btn2 = Ti.UI.createButton ({
    title: 'get active tab window title',
    top: 20,
});

btn2.addEventListener ('click', function (e) {
    var t = tabGroup.getActiveTab().getWindow ().title;
    alert (t);
});

win1.add (btn2);

var tab1 = Ti.UI.createTab({  
    title:'Win 1',
    window: win1
});

var win2 = Ti.UI.createWindow ({
    title: "Win 2"
});

var tab2 = Ti.UI.createTab({  
    title:'Win 2',
    window: win2
});

tabGroup.addTab(tab1);  
tabGroup.addTab(tab2); 


// open tab group
tabGroup.open();

Expected result

Clicking on 'get active tab window title' after the subwindow is opened, should display 'Win 1'.

Additional notes

Customer's ticket: http://support.appcelerator.com/tickets/APP-314357

Comments

  1. Shameer Jan 2013-03-01

    The problem cannot reproduce with release 3.0.2 and master 3.1.0 Tested on: Titanium Studio, build: 2.1.2.201208301612 Titanium SDK version: 3.1.0 (01/03/2013) Titanium SDK version: 3.0.2 (01/03/2013) Device: Samsung galaxy s duos Android version: 4.0.4
  2. Lee Morris 2017-03-27

    Closing ticket as I am unable to reproduce this issue with the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source