svghmi/widget_button.ysl2
author dgaberscek
Wed, 22 Apr 2020 15:33:53 +0200
branchsvghmi
changeset 2944 2a20038fbea9
child 2961 00825316ed00
permissions -rw-r--r--
Added button and circular bar widgets.
2944
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     1
// widget_button.ysl2
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     2
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     3
template "widget[@type='Button']", mode="widget_defs" {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     4
    param "hmi_element";
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     5
    | frequency: 5,
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     6
    | init: function() {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     7
    |     this.element.addEventListener(
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     8
    |       "mousedown",
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     9
    |       evt => {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    10
    |           change_hmi_value(this.indexes[0], "=1");
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    11
    |       });
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    12
    |     this.element.addEventListener(
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    13
    |       "mouseup",
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    14
    |       evt => {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    15
    |           change_hmi_value(this.indexes[0], "=0");
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    16
    |       });
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    17
    | },
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
    18
}