Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7200] Android: UI.window - open event does not fire for lightweight windows when window open method is after addEventListener

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-01-16T16:47:12.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sn/a
ComponentsAndroid
Labelsregression
ReporterPaul Dowsett
AssigneeMarshall Culpepper
Created2012-01-16T04:30:35.000+0000
Updated2017-03-21T21:10:11.000+0000

Description

Problem

Window open event does not fire for lightweight windows when window open() method positioned before addEventListener The open event works as expected in 1.7.5. Hence this is a regression. Note that the focus event also suffers the same issue.

Test case

var win = Ti.UI.createWindow({
  // fullscreen:false, // enable this to workaround the issue
  backgroundColor:'red'
});

win.open(); // move this after eventListeners to workaround isssue

win.addEventListener('open', function() {
  Ti.API.info("------- Window event fired: open --------");
});

win.addEventListener('focus', function() {
  Ti.API.info("------- Window event fired: focus --------");
});

Logs

No output produced

Workaround

Use heavyweight window or ensure that window open() method is positioned after eventListeners

Comments

  1. Opie Cyrus 2012-01-16

  2. Paul Dowsett 2012-01-16

    I have double-checked this with Titanium 1.9.0 (2012/01/16 11:16 366b32d) and the issue still exists.
  3. Paul Dowsett 2012-01-16

    After speaking with Opie, the fact that this worked on 1.7.5 may have simply been a race condition that we never saw due to rhino's lower performance. open and focus eventlisteners should go before the window open method. I will raise an apidoc ticket to convey this advice. Hence, closing as invalid
  4. Ivan Skugor 2012-01-17

  5. Lee Morris 2017-03-21

    Closing ticket as invalid.

JSON Source