svghmi/widget_button.ysl2
changeset 3520 b27e50143083
parent 3419 76995a304fe0
child 3596 9c725829d8f0
--- a/svghmi/widget_button.ysl2	Mon Jun 20 09:30:11 2022 +0200
+++ b/svghmi/widget_button.ysl2	Wed Jun 22 11:48:40 2022 +0200
@@ -183,19 +183,13 @@
     apply "$fsm", mode="actions";
 
     |     animate(){
-    |         if (this.active_elt && this.inactive_elt) {
-    foreach "str:split('active inactive')" {
-    |             if(this.display == "«.»")
-    |                 this.«.»_elt.style.display = "";
-    |             else
-    |                 this.«.»_elt.style.display = "none";
-    }
-    |         }
+    |         this.set_activation_state(this.display == "active");
     |     }
 
     |     init() {
     |         this.bound_onmouseup = this.onmouseup.bind(this);
     |         this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
+    |         this.set_activation_state(undefined);
     |     }
 }
 
@@ -207,7 +201,7 @@
 }
 
 widget_defs("Button") {
-    optional_labels("active inactive");
+    activable();
 }
 
 widget_class("PushButton"){
@@ -217,6 +211,6 @@
 }
 
 widget_defs("PushButton") {
-    optional_labels("active inactive");
-}
-
+    activable();
+}
+