{ "id": "79942", "key": "TIMOB-5192", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-08-01T01:32:05.000+0000", "created": "2011-09-01T14:52:27.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_window", "qe-testadded" ], "versions": [ { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "issuelinks": [], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-12-02T09:14:53.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h3.Problem\r\n\"focus\" event is not fired while it should be. The \"open\" event is fired twice while entering to the application.\r\n\r\nh3.Reproducible Steps\r\n1. Run the attached code. This application is presenting the four (\"open\",\"close\",\"blur\",\"focus\") events. While the event for win1, win2, navGroup are fired in the log terminal you would see the information.\r\n2. Look that after running the application we get these logs:\r\n[INFO] Win1 received \"open\" event.\r\n[INFO] Win1 received \"open\" event.\r\n\r\nIt means that \"open\" event was fired twice (why?) and there is no \"focus\" event for win1.\r\n3. Click at the \"Open Win2\" button.\r\n4. Look at the logs:\r\n[INFO] clicked b1\r\n[INFO] Win1 received \"blur\" event.\r\n[INFO] Win2 received \"open\" event.\r\nWe don't receive the \"focus\" event for Win2, however this window gained the focus.\r\n5. Click at the button \"Close Win2\"\r\n6. Look at the logs:\r\n[INFO] Win2 received \"blur\" event.\r\n[INFO] Win1 received \"focus\" event.\r\n[INFO] Win2 received \"close\" event.\r\n[INFO] Win1 received \"open\" event.\r\nThat is correct.\r\n\r\nh3.Sample Code\r\n\r\n{code}\r\nvar mainWin = Ti.UI.createWindow({backgroundColor:'yellow'});\r\nvar navGroup = Ti.UI.iPhone.createNavigationGroup();\r\n\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Win1',\r\n backgroundColor:'white'\r\n});\r\n\r\nvar win2 = Titanium.UI.createWindow({\r\n\ttitle:'Win2',\r\n\tbackgroundColor:'40A040'\r\n});\r\n\r\nvar b1 = Titanium.UI.createButton({\r\n\ttitle:'Open Win2',\r\n\twidth:150, height:50\r\n});\r\nwin1.add(b1);\r\n\r\nb1.addEventListener('click', function(e){\r\n\tTi.API.info('clicked b1');\r\n\tnavGroup.open(win2);\r\n});\r\n\r\nwin1.addEventListener(\"close\",function(e){\r\n\talert(\"close\");\r\n});\r\n\r\nvar b2 = Titanium.UI.createButton({\r\n\ttitle:'Close Win2',\r\n\twidth:150, height:50\r\n});\r\nwin2.add(b2);\r\n\r\nb2.addEventListener('click', function(e){\r\n\tTi.API.info('clicked b2');\r\n\tnavGroup.close(win2);\r\n});\r\n\r\nfunction addEventListener(obj, eventName) {\r\n\tobj.addEventListener(eventName, function (e) {\r\n\t\tTi.API.info(obj.title + ' received \"' + eventName + '\" event. Source: ' + e.source);\r\n\t});\r\n}\r\n\r\nvar eventNames = [ 'open', 'close', 'blur', 'focus' ];\r\nvar objects = [ win1, win2, navGroup ];\r\n\r\nfor(var i=0; i