Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23275] Windows: Deprecate Ti.UI.View.enabled, rename to touchEnabled

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-05-05T13:33:53.000+0000
Affected Version/sRelease 5.3.0
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsparity, qe-5.3.0, qe-5.4.0, windows
ReporterHarry Bryant
AssigneeChristopher Williams
Created2016-04-26T18:28:42.000+0000
Updated2016-06-27T17:14:55.000+0000

Description

While reviewing a windows ticket, implementing the enabled property for view elements, it was found that it was not implemented for iOS. This should be fixed to achieve parity between android & windows. *TEST CODE:*
var win = Ti.UI.createWindow({});

var view1 = Ti.UI.createView({
    backgroundColor: "Magenta",
    enabled: true,
    left: 0,
    top: 50,
    height: 100,
    width: 100
});

view1.addEventListener('click', function() {
    alert("CLICKED! 1");
});

var view2 = Ti.UI.createView({
    backgroundColor: "green",
    enabled: false,
    top: 50,
    left: 200,
    height: 100,
    width: 100
});

view2.addEventListener('click', function() {
    alert("CLICKED! 2");
});

win.add(view1);
win.add(view2);
win.open()

Steps to Reproduce

1. Create a default classic mobile project. 2. Apply test code above to app.js file. 3. Deploy app to iOS simulator / device. 4. After launching the app, click / tap on left view. 5. Click / tap on right view.

Actual Result

Left view *enabled* property is set to true : Alert appears when clicked. Right view *enabled* property is set to false : Alert appears when clicked.

Expected Result.

Left view *enabled* property is set to true : Alert *should* appear when clicked. Right view *enabled* property is set to false : Alert *should NOT* appear when clicked.

Comments

  1. Angel Petkov 2016-04-27

    [~htbryant] On iOS the property is called touchEnabled, enabled isn't a property of the view on iOS according to the documentation. To Achieve parity we need to rename touchEnabled to enabled on iOS or rename it on Windows. Since its also called touchEnabled on android it would be best to rename the property on windows.
  2. Hans Knöchel 2016-04-28

    We used to call it enabled in earlier releases and introduced touchEnabled in both iOS and Android instead, which was a while ago. I'd prefer Windows to migrate the property, since it's a new platform. /cc [~cwilliams]
  3. Harry Bryant 2016-04-28

    I agree that it would be a better option for Windows to adopt the touchEnabled property.
  4. Christopher Williams 2016-04-29

    Looks like we need to rename the new "enabled" property to touchEnabled. We should probably leave "enabled", log a warning that it's deprecated and forward the call to enabled.
  5. Christopher Williams 2016-05-04

    https://github.com/appcelerator/titanium_mobile_windows/pull/666
  6. Christopher Williams 2016-05-05

    We retained the Ti.UI.View.enabled property and it basically just forwards the property/getter/setter to touchEnabled and logs a warning to console that enabled is deprecated, please use touchEnabled.
  7. Harry Bryant 2016-06-27

    Verified as fixed, using the enabled property on windows now returns a deprecated message, and now supports the touchEnabled property. Tested on: Windows 10 Pro Windows Phone 10.0 (Microsoft Lumia 640 LTE) Appc Studio: 4.7.0.201606220541 Ti SDK: 5.4.0.v20160617074028 Appc NPM: 4.2.7-2 Appc Core: 5.4.0-18 Node: v4.4.4 *Closing Ticket.*

JSON Source