{ "id": "174380", "key": "TIMOB-27700", "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": [], "resolution": null, "resolutiondate": null, "created": "2019-11-12T10:01:13.000+0000", "priority": null, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2019-12-26T17:33:23.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "The textField.focus function does not work if you call in an event, like the open event of \r\na window, if you call on a button-click-event it works. \r\nI want that the inputField keeps the focus after the user hits the returnkey, so that\r\nhe can type in the next value immediately, without touching the textField first. \r\n\r\nIt was not a problem in SDKs < 8.00.\r\n\r\nExample:\r\n{code:js}\r\n var win = Ti.UI.createWindow({\r\n backgroundColor : '#DCDCDC'\r\n });\r\n var aButton = Titanium.UI.createButton({\r\n\t title: 'Focus textField',\r\n top:100,\r\n left:320,\r\n width: 300,\r\n\t});\r\n\taButton.addEventListener('click', function() {\r\n\t inputField.focus(); // works\r\n\t});\r\n var inputField = Titanium.UI.createTextField({\r\n\t\ttop : 100,\r\n\t\twidth:200,\r\n\t\tleft : 100,\r\n \theight:30,\r\n \tbackgroundColor:'white',\r\n\t \treturnKeyType : Titanium.UI.RETURNKEY_DONE,\r\n\t});\r\n\tinputField.addEventListener('return', function(_e) {\r\n \t\tTi.API.info(\"return\");\r\n \t _e.source.value = '';\r\n \t_e.source.focus();\r\n \t});\r\n\tinputField.addEventListener('focus', function(e) {\r\n\t\tTi.API.info(\"focus\");\r\n\t});\r\n win.add(aButton);\r\n win.add(inputField);\r\n inputField.focus(); // doesn't work\r\n win.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Problem with textField.focus()", "creator": { "name": "mlandeck", "key": "mlandeck", "displayName": "Michael Landeck", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mlandeck", "key": "mlandeck", "displayName": "Michael Landeck", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Name = Mac OS X\r\n\r\nVersion = 10.15.1\r\n\r\nArchitecture = 64bit\r\n\r\n# CPUs = 4\r\n\r\nMemory = 17179869184\r\n\r\nNode.js\r\n\r\nNode.js Version = 12.13.0\r\n\r\nnpm Version = 6.12.0\r\n\r\nTitanium CLI\r\n\r\nCLI Version = 5.2.1\r\n\r\nTitanium SDK\r\n\r\nSDK Version = 8.2.1.GA\r\n\r\nSDK Path = /Users/ml/Library/Application Support/Titanium/mobilesdk/osx/8.2.1.GA\r\n\r\nTarget Platform = iphone", "comment": { "comments": [], "maxResults": 1, "total": 1, "startAt": 0 } } }