Button Click Event Object Missing X & Y coords on iPhone
Titanium Developer (v1.2.1)
[INFO] Titanium 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
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.
1 Answer
-
What version of the SDK are you running? That link references pre-1.2.