Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2199] Button Click Event Object Missing X & Y coords on iPhone

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-07-26T11:30:51.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterSteve Day
AssigneeNeeraj Gupta
Created2011-04-15T03:13:18.000+0000
Updated2012-07-26T21:44:50.000+0000

Description

Titanium Developer (v1.2.1) - SDK version: 1.4.1.1

The Event object on the Button click event does not appear to contain much information on the iPhone. It appears to work correctly on the Android side.

Appears to be similar to https://developer.appcelerator.com/question/8431/click-event-on-an-imageview-doesnt-work"> https://developer.appcelerator.com/question/8431/click-event-on-an-...

~~~ var btn1 = Titanium.UI.createButton({image:'images/1.png',left:5,top:200,width:48,height:48,canScale:true});
btn1.addEventListener('click',function(e) {
txtInput.value+="1";
Titanium.API.debug("globalPoint:[" + e.globalPoint + "]");
Titanium.API.debug("source:[" + e.source + "]");
Titanium.API.debug("type:[" + e.type + "]");
Titanium.API.debug("x:[" + e.x + "]");
Titanium.API.debug("y:[" + e.y + "]");
});

win1.add(btn1);
~~~

OUTPUT SHOWS:

iPhone
~~~ [DEBUG] globalPoint:[undefined] [DEBUG] source:[[object TiUIButton]] [DEBUG] type:[click] [DEBUG] x:[undefined] [DEBUG] y:[undefined] ~~~

Android
~~~ [DEBUG] [69,12017] globalPoint:[undefined] [DEBUG] [11,12028] source:[ti.modules.titanium.ui.ButtonProxy@44fd77c0] [DEBUG] [1,12029] type:[click] [DEBUG] [8,12037] x:[13] [DEBUG] [11,12048] y:[11.66668701171875] ~~~

Also, when I try to access globalPoint.x (maybe I don't know how to access it correctly) but it gets an access violation. It seems to me that it is not getting populated/created on either device.

Comments

  1. Steve Day 2011-04-15

    I forgot to add the version info.

    Titanium Developer (v1.2.1)

    [INFO] Titanium SDK version: 1.4.1.1

  2. Stephen Tramer 2012-07-26

    Cannot reproduce in SDK 2.2.0.014b86f on iPhone Sim 5.1. Test:
       var win1 =Ti.UI.createWindow();
       var btn1 = Titanium.UI.createButton({image:'images/chat.png',left:5,top:200,width:48,height:48,canScale:true});
       btn1.addEventListener('click',function(e) {
       Titanium.API.debug("globalPoint:[" + e.globalPoint + "]");
       Titanium.API.debug("source:[" + e.source + "]");
       Titanium.API.debug("type:[" + e.type + "]");
       Titanium.API.debug("x:[" + e.x + "]");
       Titanium.API.debug("y:[" + e.y + "]");
       });
       
       win1.add(btn1);
       win1.open();
       

JSON Source