svghmi/widget_button.ysl2
branchsvghmi
changeset 2944 2a20038fbea9
child 2961 00825316ed00
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/widget_button.ysl2	Wed Apr 22 15:33:53 2020 +0200
@@ -0,0 +1,18 @@
+// widget_button.ysl2
+
+template "widget[@type='Button']", mode="widget_defs" {
+    param "hmi_element";
+    | frequency: 5,
+    | init: function() {
+    |     this.element.addEventListener(
+    |       "mousedown",
+    |       evt => {
+    |           change_hmi_value(this.indexes[0], "=1");
+    |       });
+    |     this.element.addEventListener(
+    |       "mouseup",
+    |       evt => {
+    |           change_hmi_value(this.indexes[0], "=0");
+    |       });
+    | },
+}
\ No newline at end of file