svghmi/widget_button.ysl2
author Edouard Tisserant
Tue, 26 May 2020 09:58:20 +0200
branchsvghmi
changeset 2971 f0a822ef9fa0
parent 2961 00825316ed00
child 2976 99c4521bb844
permissions -rw-r--r--
Solve import order problem when POULibrary imports ConfigTreeNode because of UserAddressedException. Now UserAddressedException is declared in POULibrary.py, as a quick and dirty fix, but some independant module should be created for beremiz exceptions in general.
// widget_button.ysl2

template "widget[@type='Button']", mode="widget_class"
    ||
    class ButtonWidget extends Widget{
        frequency = 5;
        init() {
            this.element.addEventListener(
              "mousedown",
              evt => {
                  change_hmi_value(this.indexes[0], "=1");
              });
            this.element.addEventListener(
              "mouseup",
              evt => {
                  change_hmi_value(this.indexes[0], "=0");
              });
        }
    }
    ||