svghmi/widget_button.ysl2
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 3086 a70a97196654
child 3241 fe945f1f48b7
--- a/svghmi/widget_button.ysl2	Thu Apr 15 09:15:23 2021 +0200
+++ b/svghmi/widget_button.ysl2	Sun May 02 23:01:08 2021 +0200
@@ -9,6 +9,8 @@
 decl show(eltname);
 decl hmi_value(value);
 
+gen_index_xhtml {
+
 // State machine to drive HMI_BOOL on a potentially laggy connection
 const "_button_fsm" fsm {
     state "init" {
@@ -104,9 +106,10 @@
     |         this.apply_hmi_value(0, «@value»);
 }
 
-template "widget[@type='Button']", mode="widget_class"{
+}
+
+widget_class("Button"){
     const "fsm","exsl:node-set($_button_fsm)";
-    | class ButtonWidget extends Widget{
     |     frequency = 5;
 
     |     display = "inactive";
@@ -145,11 +148,9 @@
     |         this.bound_onmouseup = this.onmouseup.bind(this);
     |         this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
     |     }
-    | }
 }
 
-
-template "widget[@type='Button']", mode="widget_defs" {
+widget_defs("Button") {
     param "hmi_element";
     optional_labels("active inactive");
 }