svghmi/widget_input.ysl2
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 3188 c173452bf894
child 3233 315f17e74ef5
--- a/svghmi/widget_input.ysl2	Thu Apr 15 09:15:23 2021 +0200
+++ b/svghmi/widget_input.ysl2	Sun May 02 23:01:08 2021 +0200
@@ -1,44 +1,43 @@
 // widget_input.ysl2
 
-template "widget[@type='Input']", mode="widget_class"{
-||
-    class InputWidget extends Widget{
-         on_op_click(opstr) {
-             this.change_hmi_value(0, opstr);
-         }
-         edit_callback(new_val) {
-             this.apply_hmi_value(0, new_val);
-         }
-
-         is_inhibited = false;
-         alert(msg){
-             this.is_inhibited = true;
-             this.display = msg;
-             setTimeout(() => this.stopalert(), 1000);
-             this.request_animate();
-         }
-
-         stopalert(){
-             this.is_inhibited = false;
-             this.display = this.last_value;
-             this.request_animate();
-         }
-
-         overshot(new_val, max) {
-             this.alert("max");
-         }
-
-         undershot(new_val, min) {
-             this.alert("min");
-         }
 
 
-    }
-||
+
 }
 
-template "widget[@type='Input']", mode="widget_defs" {
-    param "hmi_element";
+widget_class("Input")
+||
+     on_op_click(opstr) {
+         this.change_hmi_value(0, opstr);
+     }
+     edit_callback(new_val) {
+         this.apply_hmi_value(0, new_val);
+     }
+
+     is_inhibited = false;
+     alert(msg){
+         this.is_inhibited = true;
+         this.display = msg;
+         setTimeout(() => this.stopalert(), 1000);
+         this.request_animate();
+     }
+
+     stopalert(){
+         this.is_inhibited = false;
+         this.display = this.last_value;
+         this.request_animate();
+     }
+
+     overshot(new_val, max) {
+         this.alert("max");
+     }
+
+     undershot(new_val, min) {
+         this.alert("min");
+     }
+||
+
+widget_defs("Input") {
 
     const "value_elt" optional_labels("value");
     const "have_value","string-length($value_elt)>0";