svghmi/widget_input.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 02 May 2021 23:01:08 +0200
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 3188 c173452bf894
child 3233 315f17e74ef5
permissions -rw-r--r--
SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
     1
// widget_input.ysl2
2779
75c6a31caca6 SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents: 2763
diff changeset
     2
3100
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
     3
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
     4
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
     5
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
     6
}
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
     7
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
     8
widget_class("Input")
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
     9
||
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    10
     on_op_click(opstr) {
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    11
         this.change_hmi_value(0, opstr);
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    12
     }
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    13
     edit_callback(new_val) {
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    14
         this.apply_hmi_value(0, new_val);
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    15
     }
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    16
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    17
     is_inhibited = false;
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    18
     alert(msg){
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    19
         this.is_inhibited = true;
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    20
         this.display = msg;
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    21
         setTimeout(() => this.stopalert(), 1000);
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    22
         this.request_animate();
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    23
     }
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    24
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    25
     stopalert(){
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    26
         this.is_inhibited = false;
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    27
         this.display = this.last_value;
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    28
         this.request_animate();
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    29
     }
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    30
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    31
     overshot(new_val, max) {
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    32
         this.alert("max");
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    33
     }
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    34
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    35
     undershot(new_val, min) {
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    36
         this.alert("min");
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    37
     }
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    38
||
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    39
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3188
diff changeset
    40
widget_defs("Input") {
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    41
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    42
    const "value_elt" optional_labels("value");
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    43
    const "have_value","string-length($value_elt)>0";
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    44
    value "$value_elt";
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    45
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    46
    const "edit_elt" optional_labels("edit");
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    47
    const "have_edit","string-length($edit_elt)>0";
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    48
    value "$edit_elt";
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    49
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    50
    if "$have_value"
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    51
    |     frequency: 5,
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    52
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    53
    |     dispatch: function(value) {
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    54
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    55
3155
99ce78ddd353 SVGHMI: finally found why HMI:Input wasnt't initializing properly: vsprintf takes a list. Also, removed intermediate variable last_val, since edit_value() works on strings anyhow, and in case of formated floats, it is better to workl on already formated value.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3153
diff changeset
    56
    if "$have_value or $have_edit" {
3153
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    57
        choose{
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    58
            when "count(arg) = 1" {
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    59
    |         this.last_value = vsprintf("«arg[1]/@value»", [value]);
3153
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    60
            }
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    61
            otherwise {
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    62
    |         this.last_value = value;
3153
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    63
            }
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    64
        }
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    65
    |         if(!this.is_inhibited){
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    66
    |             this.display = this.last_value;
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    67
    if "$have_value" {
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    68
    |             this.request_animate();
3155
99ce78ddd353 SVGHMI: finally found why HMI:Input wasnt't initializing properly: vsprintf takes a list. Also, removed intermediate variable last_val, since edit_value() works on strings anyhow, and in case of formated floats, it is better to workl on already formated value.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3153
diff changeset
    69
    }
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    70
    |         }
3100
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    71
    }
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    72
    |     },
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
    73
3100
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    74
    if "$have_value" {
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    75
    |     animate: function(){
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    76
    |         this.value_elt.textContent = String(this.display);
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    77
    |     },
3100
c51f9cf365c6 SVGHMI: Input widget overrides undershot() and overshot() methods to display "min: xxx" or "max: xxx" when user input goes out of given range.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    78
    }
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    79
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    80
    |     init: function() {
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    81
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    82
    if "$have_edit" {
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3155
diff changeset
    83
    |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
3153
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    84
        if "$have_value" {
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    85
    |         this.value_elt.style.pointerEvents = "none";
671283404554 Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
    86
        }
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    87
    }
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    88
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    89
    foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" {
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3034
diff changeset
    90
    |         id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    91
    }
2911
211d6a185e31 SVGHMI: More infrastructure for editing values with a keypad.
Edouard Tisserant
parents: 2910
diff changeset
    92
211d6a185e31 SVGHMI: More infrastructure for editing values with a keypad.
Edouard Tisserant
parents: 2910
diff changeset
    93
    |     },
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    94
}