{ "id": "164372", "key": "TIMOB-24097", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-12-09T00:28:56.000+0000", "created": "2016-11-04T00:26:27.000+0000", "epic": { "id": 162541, "key": "TIMOB-23765", "name": "Hyperloop for Windows", "summary": "Windows: Direct API Access not working ", "color": { "key": "color_1" }, "done": false }, "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "issuelinks": [], "assignee": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T23:12:40.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "Event handling following JavaScript syntax by adding/removing event handlers with the {{addEventListener()}} and {{removeEventListener()}} methods rather than the C++/C# syntax. \r\n\r\nIn C++/CX, we used to do like below:\r\n\r\n{code}\r\nclick_event_ = component->Tapped += ref new TappedEventHandler([this, ctx](Platform::Object^ sender, TappedRoutedEventArgs^ e) {\r\n // do something\r\n});\r\n{code}\r\n\r\nBut in JavaScript, we want to do like this:\r\n\r\n{code}\r\ncomponent.addEventListener('Tapped', function(e) {\r\n // do something\r\n});\r\n{code}\r\n\r\nFYI: [Windows Runtime Direct API Access - Event Handling|http://docs.appcelerator.com/platform/latest/#!/guide/Windows_Runtime_Direct_API_Access-section-43315893_WindowsRuntimeDirectAPIAccess-EventHandling]\r\n\r\nTest code:\r\n\r\n{code}\r\nrequire('Windows.UI.Xaml.Input.TappedRoutedEventArgs');\r\n\r\nvar win = Ti.UI.createWindow({ backgroundColor: 'green' }),\r\n Button = require('Windows.UI.Xaml.Controls.Button'),\r\n button = new Button();\r\n\r\nbutton.Content = \"PUSH\";\r\nbutton.addEventListener('Tapped', function (e) {\r\n var pos = e.GetPosition(null);\r\n Ti.API.info(pos.X + ' -' + pos.Y);\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Windows: Native event handling", "creator": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 770, "state": "closed", "name": "2016 Sprint 25 SDK", "startDate": "2016-12-03T01:53:07.491Z", "endDate": "2016-12-17T01:53:00.000Z", "completeDate": "2016-12-21T03:19:43.884Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "402855", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "https://github.com/appcelerator/titanium_mobile_windows/pull/899", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-12-07T07:17:13.000+0000", "updated": "2016-12-07T07:17:13.000+0000" }, { "id": "408610", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Environment: \r\nNPM Version: 2.15.9 \r\nNode Version: 4.6.0 \r\nWindows OS: 10.0.14393.693 \r\nAppc CLI: 6.1.0 \r\nAppc CLI NPM: 4.2.8 \r\nTitanium SDK version: 6.1.0.v20170227120704\r\nAppcelerator Studio, build: 4.8.1.201612050850 \r\nWindows Device: 8.1 and 10.0.14393\r\nWindows Emulator 8.1 and 10.0.14393\r\n\r\nI validated the fix with both emulator and device using the demo code given in the description. I found that the app worked as expected. That is when I clicked on the \"Push\" button, I was able to see the xy info on the console.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T23:12:07.000+0000", "updated": "2017-03-02T23:12:07.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }