svghmi/widget_display.ysl2
branchsvghmi
changeset 3241 fe945f1f48b7
parent 3232 7bdb766c2a4d
child 3329 d44b6346d4c2
equal deleted inserted replaced
3238:8a9d4c794cba 3241:fe945f1f48b7
     1 // widget_display.ysl2
     1 // widget_display.ysl2
       
     2 
       
     3 widget_desc("Display") {
       
     4     longdesc
       
     5     ||
       
     6     If Display widget is a svg:text element, then text content is replaced by
       
     7     value of given variables, space separated.
       
     8 
       
     9     Otherwise, if Display widget is a group containing a svg:text element
       
    10     labelled "format", then text content is replaced by printf-like formated
       
    11     string. In other words, if "format" labeled text is "%d %s %f", then 3
       
    12     variables paths are expected : HMI_IN, HMI_STRING and HMI_REAL.
       
    13 
       
    14     In case Display widget is a svg::text element, it is also possible to give
       
    15     format string as first argument.
       
    16     ||
       
    17 
       
    18     shortdesc > Printf-like formated text display 
       
    19 
       
    20     arg name="format" count="optional" accepts="string" > printf-like format string when not given as svg:text
       
    21 
       
    22     path name="fields" count="many" accepts="HMI_INT,HMI_REAL,HMI_STRING,HMI_BOOL" > variables to be displayed
       
    23     
       
    24 }
     2 
    25 
     3 
    26 
     4 widget_class("Display")
    27 widget_class("Display")
     5     ||
    28     ||
     6         frequency = 5;
    29         frequency = 5;
     9             this.request_animate();
    32             this.request_animate();
    10         }
    33         }
    11     ||
    34     ||
    12 
    35 
    13 widget_defs("Display") {
    36 widget_defs("Display") {
    14     param "hmi_element";
       
    15 
       
    16     const "format" optional_labels("format");
    37     const "format" optional_labels("format");
    17     const "has_format","string-length($format)>0";
    38     const "has_format","string-length($format)>0";
    18     value "$format";
    39     value "$format";
    19 
    40 
    20     if "$hmi_element[not(self::svg:text)] and not($has_format)"
    41     if "$hmi_element[not(self::svg:text)] and not($has_format)"