svghmi/widget_input.ysl2
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 3188 c173452bf894
child 3233 315f17e74ef5
equal deleted inserted replaced
3231:5243c2a2f7f8 3232:7bdb766c2a4d
     1 // widget_input.ysl2
     1 // widget_input.ysl2
     2 
     2 
     3 template "widget[@type='Input']", mode="widget_class"{
       
     4 ||
       
     5     class InputWidget extends Widget{
       
     6          on_op_click(opstr) {
       
     7              this.change_hmi_value(0, opstr);
       
     8          }
       
     9          edit_callback(new_val) {
       
    10              this.apply_hmi_value(0, new_val);
       
    11          }
       
    12 
       
    13          is_inhibited = false;
       
    14          alert(msg){
       
    15              this.is_inhibited = true;
       
    16              this.display = msg;
       
    17              setTimeout(() => this.stopalert(), 1000);
       
    18              this.request_animate();
       
    19          }
       
    20 
       
    21          stopalert(){
       
    22              this.is_inhibited = false;
       
    23              this.display = this.last_value;
       
    24              this.request_animate();
       
    25          }
       
    26 
       
    27          overshot(new_val, max) {
       
    28              this.alert("max");
       
    29          }
       
    30 
       
    31          undershot(new_val, min) {
       
    32              this.alert("min");
       
    33          }
       
    34 
     3 
    35 
     4 
    36     }
     5 
    37 ||
       
    38 }
     6 }
    39 
     7 
    40 template "widget[@type='Input']", mode="widget_defs" {
     8 widget_class("Input")
    41     param "hmi_element";
     9 ||
       
    10      on_op_click(opstr) {
       
    11          this.change_hmi_value(0, opstr);
       
    12      }
       
    13      edit_callback(new_val) {
       
    14          this.apply_hmi_value(0, new_val);
       
    15      }
       
    16 
       
    17      is_inhibited = false;
       
    18      alert(msg){
       
    19          this.is_inhibited = true;
       
    20          this.display = msg;
       
    21          setTimeout(() => this.stopalert(), 1000);
       
    22          this.request_animate();
       
    23      }
       
    24 
       
    25      stopalert(){
       
    26          this.is_inhibited = false;
       
    27          this.display = this.last_value;
       
    28          this.request_animate();
       
    29      }
       
    30 
       
    31      overshot(new_val, max) {
       
    32          this.alert("max");
       
    33      }
       
    34 
       
    35      undershot(new_val, min) {
       
    36          this.alert("min");
       
    37      }
       
    38 ||
       
    39 
       
    40 widget_defs("Input") {
    42 
    41 
    43     const "value_elt" optional_labels("value");
    42     const "value_elt" optional_labels("value");
    44     const "have_value","string-length($value_elt)>0";
    43     const "have_value","string-length($value_elt)>0";
    45     value "$value_elt";
    44     value "$value_elt";
    46 
    45