[TIMOB-6393] Android: Lightweight Window, Source of Events is undefined
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-18T16:17:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.8.0.1, Sprint 2012-02, Release 2.0.0, Release 1.8.1 |
Components | Android |
Labels | branch-v8, module_window, parity, qe-testadded |
Reporter | Ping Wang |
Assignee | Ping Wang |
Created | 2011-11-30T15:05:14.000+0000 |
Updated | 2012-03-04T22:12:16.000+0000 |
Description
Run the code below.
Click the anywhere in the window except the bottom label, the bottom label shows "window: You clicked on undefined".
Expected behavior: The bottom label shows "window: You clicked on window".
var win = Ti.UI.createWindow();
win.backgroundColor = '#13386c';
win.name = "window";
var l2 = Ti.UI.createLabel({
color:'white',
font:{fontSize:14,fontWeight:'bold',fontFamily:'Helvetica Neue'},
bottom:5,
textAlign:'center',
text:'click anywhere',
height:'auto',
width:'auto'
});
win.add(l2);
function clear(o)
{
var t = o.text;
setTimeout(function()
{
if (o.text == t)
{
o.text = "";
}
},1000);
}
win.addEventListener('click',function(ev)
{
l2.text = "window: You clicked on " +ev.source.name;
clear(l2);
});
win.open();
Tested with 1.8.0.1.v20111220190134 on LG Slate (3.1) v8/rhino
Still encountering the issue. If you click in the label area when the label is not invoked you will see "You clicked on a window", but if you click the label area when it is invoked, you get "You click on undefined" Tested with 1.8.0.1
When we click the label area, the source of events is the label. Since we don't specify the name of the the label in the code, it will show "You click on undefined". Therefore, it's an expected behavior. In order to avoid such confusion, write another test sample below.
Click anywhere in the window and check the log. The expected behavior: "window: You clicked on window" shows in the log.
Tested with 1.9.0.v20120118110134