Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4475] iOS: globalPoint is undefined for a click event if you add a tableView to a window

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-10-27T15:54:20.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sSprint 2011-28, Release 1.8.0
ComponentsiOS
Labelsn/a
ReporterJon Alter
AssigneeBlain Hamon
Created2011-06-21T16:23:31.000+0000
Updated2011-10-27T15:54:20.000+0000

Description

e.globalPoint is undefined for a click event if a tableView has been added to a window. This is true if you add the event listener to the window or the tableView. Step 1: run the code below Step 2: tap on the tableView Step 3: in the log you will see that globalPoint is undefined Step 4: comment out win1.add(tableView); Step 5: run code Step 6: tap window Step 7: in the log globalPoint will be an [Object]
var tabGroup = Titanium.UI.createTabGroup();

var win1 = Ti.UI.createWindow({
    backgroundColor:'#f00',
    title:'Red'
});
win1.addEventListener('click', function(e) {
    // alert(e.globalPoint.x + '\n' + e.globalPoint.y);
    Ti.API.info('e.x: '+e.x+' e.y: '+e.y);
    Ti.API.info('e.globalPoint: '+e.globalPoint);
});

var tab1 = Titanium.UI.createTab({
    title:'Red',
    window:win1
});

var win2 = Ti.UI.createWindow({
    backgroundColor:'#0f0',
    title:'Green'
});
win2.addEventListener('click', function(e) {
    // alert(e.globalPoint.x + '\n' + e.globalPoint.y);
    Ti.API.info('e.x: '+e.x+' e.y: '+e.y);
    Ti.API.info('e.globalPoint: '+e.globalPoint);
});

var tab2 = Titanium.UI.createTab({
    title:'Green',
    window:win2
});

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

//TABLE VIEW

var data = [];
for (var i = 0; i < 10; i++) {
    data.push({title: 'Row '+i});
}

var tableView = Ti.UI.createTableView({
    data:data
});

win1.add(tableView);

tabGroup.open();

Associated Helpdesk Ticket

http://appc.me/c/APP-454718

Comments

  1. Reggie Seagraves 2011-06-30

    Coordinate Android team implementation.
  2. Natalie Huynh 2011-08-25

    Tested with 1.8.0.v20110819142548 iPhone 4.3.4 iPad2 4.3.2

JSON Source