Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11031] Android: Window in tab group fails to register click events

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-10-09T02:14:49.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.0.0, Sprint 2012-20 API, 2012 Sprint 20
ComponentsAndroid
Labelsapi, module_tabgroup, qe-testadded, regression
ReporterArthur Evans
AssigneeHieu Pham
Created2012-09-20T16:06:53.000+0000
Updated2013-07-16T10:21:34.000+0000

Description

When running an app with a tab group, with a click event listener registered on one of the windows in the tab group, the click event is never generated. This is a regression--the code works fine on 2.1.2.GA but fails on master (3.0).

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
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'
});
 
win1.addEventListener('open', function(){
    alert('win1 open event fired');
});

win1.addEventListener('click', function(e) {
	alert('win1 clicked!');
});
 
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);
 
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
 
win2.addEventListener('open', function(){
    alert('win2 open event fired');
});
 
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

Comments

  1. Hieu Pham 2012-10-06

       // this sets the background color of the master UIView (when there are no windows/tab groups on it)
       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'
       });
         
       win1.addEventListener('open', function(){
           Ti.API.info('win1 open event fired');
       });
          
       win1.addEventListener('click', function(e) {
           Ti.API.info('win1 clicked');
       });
       
       win1.addEventListener('close', function(e) {
       	Ti.API.info('win1 closed');
       });
       
       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);
       //win1.open();
         
       //
       // create controls tab and root window
       //
       var win2 = Titanium.UI.createWindow({  
           title:'Tab 2',
           backgroundColor:'#fff'
       });
         
       win2.addEventListener('open', function(){
           alert('win2 open event fired');
       });
         
       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);
         
       win2.addEventListener('click', function(e) {
           Ti.API.info('win2 clicked');
       });
        
         
       //
       //  add tabs
       //
       tabGroup.addTab(tab1);  
       tabGroup.addTab(tab2);  
       
       tabGroup.addEventListener('open', function(e) {
           Ti.API.info('tabGroup opened');
       });
       
       tabGroup.addEventListener('close', function(e) {
           Ti.API.info('tabGroup closed');
       });
       
       tabGroup.addEventListener('click', function(e) {
       	Ti.API.info('tabGroup clicked');
       });
       tabGroup.open();
       
       
  2. Ingo Muschenetz 2012-10-09

    PR: https://github.com/appcelerator/titanium_mobile/pull/3134
  3. Anshu Mittal 2012-10-25

    Tested with: SDK:3.0.0.v20121024144610 Studio: 3.0.0.201210220122 Device:HTC Desire V(Android 4.0.3) Click events are registered successfully on Window in tab Group.

JSON Source