Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Button Click Event Object Missing X & Y coords on iPhone

Titanium Developer (v1.2.1)
[INFO] Titanium SDK version:

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

var btn1 = Titanium.UI.createButton({image:'images/1.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 + "]");




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


[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.

— asked October 27th 2010 by Steven Day
  • android
  • button
  • event
  • iphone

1 Answer

  • What version of the SDK are you running? That link references pre-1.2.

    — answered October 27th 2010 by John Welch
    1 Comment
    • ooops, forgot to add that info. I added it to the top of the question. [INFO] Titanium SDK version: and developer 1.2.1

      — commented October 27th 2010 by Steven Day
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.