svghmi/widget_input.ysl2
branchsvghmi
changeset 3118 e704b0487515
parent 3101 4cbf024a6640
child 3153 671283404554
equal deleted inserted replaced
3117:f058542d0caa 3118:e704b0487515
    25 ||
    25 ||
    26 }
    26 }
    27 
    27 
    28 template "widget[@type='Input']", mode="widget_defs" {
    28 template "widget[@type='Input']", mode="widget_defs" {
    29     param "hmi_element";
    29     param "hmi_element";
    30 
       
    31     const "key_pos_elt" optional_labels("key_pos");
       
    32     value "$key_pos_elt";
       
    33 
    30 
    34     const "value_elt" optional_labels("value");
    31     const "value_elt" optional_labels("value");
    35     const "have_value","string-length($value_elt)>0";
    32     const "have_value","string-length($value_elt)>0";
    36     value "$value_elt";
    33     value "$value_elt";
    37 
    34 
    60     }
    57     }
    61 
    58 
    62     |     init: function() {
    59     |     init: function() {
    63 
    60 
    64     if "$have_edit" {
    61     if "$have_edit" {
    65     |         this.edit_elt.onclick = () => edit_value(
    62     |         this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_val);
    66     |             "«path/@value»", "«path/@type»",
       
    67     |             this, this.last_val, 
       
    68         choose {
       
    69             when "string-length($key_pos_elt)>0"
       
    70     |             this.key_pos_elt.getBBox()
       
    71             otherwise
       
    72     |             undefined
       
    73         }
       
    74     |         );
       
    75     }
    63     }
    76 
    64 
    77     foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" {
    65     foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" {
    78     |         id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
    66     |         id("«@id»").onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
    79     }
    67     }