Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9412] iOS: Tabgroup - Calling GetWindow() method of the active tab crashes the application.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-06-25T14:51:47.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, qe-ios060112
ReporterAnshu Mittal
AssigneeNeeraj Gupta
Created2012-06-06T05:32:17.000+0000
Updated2017-03-09T23:33:00.000+0000

Description

Calling GetWindow() method of the active tab crashes the application. This is not a regression. The issue occurs as far back as 1.8.2 Steps to Reproduce: 1. Create an application with the code below. 2. Launch the app. Actual: Application gets crashed. The below code provides the window object but app crashes with the error Script. (Error = 'undefined' is not a function (evaluating 'tabGroup.activeTab.getWindow()') at app.js) Expected: Should be able to invoke the method without any error.

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

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win1.add(label1);

tabGroup.addTab(tab1);  

tabGroup.setActiveTab(0);

alert(tabGroup.activeTab);
alert(tabGroup.activeTab.getWindow()); 
tabGroup.open();

Attachments

FileDateSize
Logs.txt2012-06-06T05:32:17.000+00001058

Comments

  1. Vishal Duggal 2012-06-25

    tabGroup.setActiveTab(0); is translated to a TiUITab object only after the tabgroup opens. Before that tabgroup.activeTab just return 0 and not the object. Either add the alerts to the open event handler of the tabGroup or use tabGroup.setActiveTab(tab1);
  2. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source