{ "id": "62055", "key": "TIMOB-1423", "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": "11363", "description": "Mobile 1.8.0 M10", "name": "Sprint 2011-31", "archived": true, "released": true, "releaseDate": "2011-08-08" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-11-05T15:25:17.000+0000", "created": "2011-04-15T02:51:57.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-11-05T15:25:17.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": "{html}

Create a tab bar with a couple of tab buttons.

\r\n

One of the tab buttons opens a window. This window opens another\r\nwindow with a back button (in example below from a table view).\r\nClicking on the back button, the original window fires a focus\r\nevent which is fine. However, when the second window is open, if\r\nyou click the tab button again (NOT the back button) to go back to\r\nthe original window, the original window's focus event fires, then\r\nthe blur event, then focus. Only the focus event should fire\r\nonce!

\r\n

Code (test2.js doesn't really do anything but is not important\r\nhere)

\r\n
\r\n// get current window\r\nvar win = Titanium.UI.currentWindow;\r\nvar data = [{title:'row 1'},{title:'row 2'},{title:'row 3'},{ title:'row 4'}];\r\nvar table = Ti.UI.createTableView({data:data, editable:false});
\r\n
\r\n\r\n\r\n
\r\ntable.addEventListener('click', function(e)\r\n{
\r\n
\r\n
\r\n\r\n\r\n
\r\n
\r\n
\r\nvar newwin = Titanium.UI.createWindow({\r\n    title:'test 2',\r\n    backButtonTitle : 'Back',\r\n    url:'../scripts/test2.js'\r\n});\r\n\r\n// open the window in the current tab\r\nTitanium.UI.currentWindow.tabGroup.activeTab.open(newwin,{animated:true});\r\n
\r\n
\r\n\r\n\r\n
\r\n});\r\n\r\n
\r\nwin.addEventListener(\"focus\",function(e) {\r\nTi.API.info('test focus');\r\n\r\n
\r\n
\r\ntable.data = data;\r\n
\r\n
\r\n\r\n\r\n
\r\n});\r\n\r\n
\r\nwin.addEventListener(\"blur\",function(e) {\r\nTi.API.info('test blur');\r\n\r\n
\r\n
\r\ntable.data = [];\r\n
\r\n
\r\n\r\n\r\n
\r\n});\r\n\r\n
\r\nwin.add(table);\r\n
{html}", "attachment": [], "flagged": false, "summary": "iOS: Window focus and blur events fire twice", "creator": { "name": "jonclarke", "key": "jonclarke", "displayName": "Jon Clarke", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jonclarke", "key": "jonclarke", "displayName": "Jon Clarke", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125629", "author": { "name": "vincentyoumans", "key": "vincentyoumans", "displayName": "vincent youmans", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

when returning from newwin, is there a way to fire a refresh\nevent on win? I have been trying to do this by calling the \"focus\"\nevent on win, but it only fires the first time win opens. Not when\nreturning from newwin.

\n

any ideas?

{html}", "updateAuthor": { "name": "vincentyoumans", "key": "vincentyoumans", "displayName": "vincent youmans", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:51:58.000+0000", "updated": "2011-04-15T02:51:58.000+0000" }, { "id": "125630", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Preliminary testing indicates this is still valid.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:51:59.000+0000", "updated": "2011-04-15T02:51:59.000+0000" }, { "id": "125631", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

A Helpdesk\ncustomer is having the same problem. I'm just confirming that\nthe bug still exist.

\n

There is also a related problem: tabGroup focus fires three\ntimes when opened. Example code:

\n
\nvar tabGroup = Titanium.UI.createTabGroup();\n\nvar win1 = Titanium.UI.createWindow({backgroundColor:'#ccc'});\nvar tab1 = Titanium.UI.createTab({window:win1});\n\nvar win2 = Titanium.UI.createWindow({backgroundColor:'#fff'});\nvar tab2 = Titanium.UI.createTab({window:win2});\n\ntabGroup.addTab(tab1);\ntabGroup.addTab(tab2);  \n\ntabGroup.open();\n\ntabGroup.addEventListener('focus', function(e){\n    Ti.API.info(e);\n});\n
\n

Console:

\n
\n[INFO] {\n    index = \"-1\";\n    previousIndex = \"-1\";\n    source = \"[object TiUITabGroup]\";\n    type = focus;\n}\n[INFO] {\n    index = 0;\n    previousIndex = \"-1\";\n    source = \"[object TiUITabGroup]\";\n    tab = \"[object TiUITab]\";\n    type = focus;\n}\n[INFO] {\n    index = 0;\n    previousIndex = \"-1\";\n    previousTab = \"<null>\";\n    source = \"[object TiUITabGroup]\";\n    tab = \"[object TiUITab]\";\n    type = focus;\n}\n
\n

iPhone Simulator 4.2
\nTi SDK 1.6 RC1

{html}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:51:59.000+0000", "updated": "2011-04-15T02:51:59.000+0000" }, { "id": "158972", "author": { "name": "mvizcaino", "key": "mvizcaino", "displayName": "Miguel Vizcaino", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{code:title=app.js|borderStyle=solid}\r\nvar tabGroup = Ti.UI.createTabGroup();\r\nvar win1 = Titanium.UI.createWindow({\r\n title:'Tab 1',\r\n backgroundColor:'blue',\r\n url:'tableviewmainwindow.js'\r\n});\r\ntab1 = Titanium.UI.createTab({ \r\n icon:'KS_nav_views.png',\r\n title:'Tab 1',\r\n \twindow: win1\r\n});\r\nvar win2 = Titanium.UI.createWindow({\r\n title:'Tab 1',\r\n backgroundColor:'blue'\r\n});\r\nvar tab2 = Titanium.UI.createTab({ \r\n icon:'KS_nav_ui.png',\r\n title:'Tab 2',\r\n window:win2\r\n});\r\ntabGroup.addTab(tab1); \r\ntabGroup.addTab(tab2); \r\ntabGroup.open();\r\n{code}\r\n\r\n{code:title=tableviewmainwindow.js|borderStyle=solid}\r\nvar win = Ti.UI.currentWindow;\r\nvar tab = Ti.UI.currentTab;\r\nvar data = [];\r\nvar tableView = Ti.UI.createTableView({\r\n\ttop:25,\r\n\tleft:0,\r\n\tbottom:15,\r\n backgroundImage:'images/apple.jpg',\r\n\tdata:data,\r\n\tbackgroundColor:'white',\t\r\n\tstyle: Titanium.UI.iPhone.TableViewStyle.GROUPED\r\n});\r\nvar logout_title = Ti.UI.createLabel({\r\n\ttext: \"Logout\",\r\n\tcolor: '#fff',\r\n\ttextAlign:'left',\r\n\tleft:10,\r\n\theight:'auto',\r\n\twidth:'auto',\r\n\ttop:10,\r\n\tfont:{fontWeight:'bold',fontSize:18}\r\n});\r\nvar row1 = Ti.UI.createTableViewRow({\r\n\theight:50,\r\n\tfontFamily:'Arial',\r\n\tfontSize:6, color:'#fff',\r\n\tbackgroundColor:'#660099'\r\n});\r\nrow1.add(logout_title);\r\nrow1.selectionStyle = Ti.UI.iPhone.TableViewCellSelectionStyle.NONE;\r\nrow1.className = 'control';\r\nrow1.hasChild = true;\r\ndata[0]=row1;\r\ntableView.setData(data);\r\n\r\ntableView.addEventListener('click', function(e){\r\n\tTi.API.info('item index clicked :'+e.index);\r\n\twinMsgDetails = Titanium.UI.createWindow({\r\n\t\turl:'tableviewchildwindow.js',\r\n\t\ttitle:'',\r\n\t\tbackgroundColor:'#fff',\r\n\t\tbarColor:'#111',\t\r\n\t});\r\n\twinMsgDetails.addEventListener ('focus', function(e)\r\n\t{\t\r\n\t\talert('Got Focus Child');\r\n\t});\r\n \ttab.open(winMsgDetails, { animated:true });\r\n});\r\nwin.add(tableView);\r\n\r\nwin.addEventListener ('focus', function(e) {\t\r\n\talert('Got Focus Main');\r\n});\r\n{code}\r\n\r\n{code:title=tableviewchildwindow.js|borderStyle=solid}\r\nvar win = Ti.UI.currentWindow;\r\nvar data = [];\r\nvar tableView = Ti.UI.createTableView({\r\n\ttop:25,\r\n\tleft:0,\r\n backgroundImage:'/images/apple.jpg',\r\n\tdata:data,\r\n\tstyle: Titanium.UI.iPhone.TableViewStyle.GROUPED\r\n});\r\nvar logout_title = Ti.UI.createLabel({\r\n\ttext: \"Off\",\r\n\tcolor: '#fff',\r\n\ttextAlign:'left',\r\n\tleft:10,\r\n\theight:'auto',\r\n\twidth:'auto',\r\n\ttop:10,\r\n\tfont:{ fontWeight:'bold', fontSize:18 }\r\n});\r\nvar row1 = Ti.UI.createTableViewRow({\r\n\theight:50,\r\n\tfontFamily:'Arial',\r\n\tfontSize:6,\r\n\tcolor:'#fff',\r\n\tbackgroundColor:'#660099'\r\n});\r\nrow1.add(logout_title);\r\nrow1.selectionStyle = Ti.UI.iPhone.TableViewCellSelectionStyle.NONE;\r\nrow1.className = 'control';\r\nrow1.hasChild = false;\r\ndata[0] = row1;\r\ntableView.setData(data);\r\nwin.add(tableView);\r\n{code} \r\n\r\nh3. Associated Helpdesk Ticket\r\n\r\nhttp://support.appcelerator.com/tickets/APP-953212", "updateAuthor": { "name": "mvizcaino", "key": "mvizcaino", "displayName": "Miguel Vizcaino", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-07T16:09:18.000+0000", "updated": "2011-07-07T16:09:18.000+0000" }, { "id": "161030", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "h4.Additional info\r\nTested with TiSDK 1.7.x and monitored the FOCUS event that is being fired 4 times.\r\n\r\nh4.Tested on\r\niPhone Simulator 4.2\r\n\r\nh4.Console output\r\n{noformat}\r\n[INFO] Focus fired\r\n\r\n[INFO] Focus fired\r\n\r\n[INFO] Focus fired\r\n\r\n[INFO] Focus fired\r\n{noformat}", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-07-28T15:54:43.000+0000", "updated": "2011-07-28T15:54:43.000+0000" }, { "id": "164376", "author": { "name": "vsingh", "key": "vsingh", "displayName": "Vikramjeet Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested On: \nMac OSX Lion\nTiMob: 1.8.0v20110819142548\nTiStud: 1.0.4.201108101535\n\nDevices:\niPhone4 version 4.2.10\niPad2 version 4.3.5\niPod 3", "updateAuthor": { "name": "vsingh", "key": "vsingh", "displayName": "Vikramjeet Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-29T12:34:53.000+0000", "updated": "2011-08-29T12:34:53.000+0000" }, { "id": "171658", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Standardizing summary and labels.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-05T15:24:06.000+0000", "updated": "2011-11-05T15:24:06.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }