No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Canvas.setEnabled() deprecation

    SmartClient version: v12.0p_2022-12-02/LGPL Deployment
    Browser: Version 112.0.5615.49 (Official Build) (x86_64)

    I was curious about why Canvas.setEnabled() was deprecated. I find that having to use Canvas.setDisabled() exclusively results in code that contains a lot of double negatives. Can this method be un-deprecated? If not, is it safe to add a polyfill for it?

    The underlying property is "disabled" and for typical code, we were finding that it was clearer to use setDisabled(). Perhaps your codebase is different - you can of course add an API to use the terminology you prefer, but overriding a core framework method is not a supported technique.

    Separately, consider the "enableWhen" property (available on multiple components). This is a much more declarative technique, and can be far simpler, since it automatically updates the target components' enabled status based on criteria, rather than relying on a series of event handlers installed in various places, which is typically more code and may not catch all relevant cases.

    Also, the enableWhen property can be visually edited by non-developers inside Reify, and Reify can also show it to a non-developer in natural language (for example, a plain English description).