svghmi/widget_foreach.ysl2
branchsvghmi
changeset 3241 fe945f1f48b7
parent 3232 7bdb766c2a4d
child 3603 f1a00aa8cb3b
equal deleted inserted replaced
3238:8a9d4c794cba 3241:fe945f1f48b7
       
     1 // widget_foreach.ysl2
       
     2 
       
     3 widget_desc("ForEach") {
       
     4 
       
     5     longdesc
       
     6     ||
       
     7     ForEach widget is used to span a small set of widget over a larger set of
       
     8     repeated HMI_NODEs. 
       
     9 
       
    10     Idea is somewhat similar to relative page, but it all happens inside the
       
    11     ForEach widget, no page involved.
       
    12 
       
    13     Together with relative Jump widgets it can be used to build a menu to reach
       
    14     relative pages covering many identical HMI_NODES siblings.
       
    15 
       
    16     ForEach widget takes a HMI_CLASS name as argument and a HMI_NODE path as
       
    17     variable.
       
    18 
       
    19     Direct sub-elements can be either groups of widget to be spanned, labeled
       
    20     "ClassName:offset", or buttons to control the spanning, labeled
       
    21     "ClassName:+/-number".
       
    22     ||
       
    23 
       
    24     shortdesc > span widgets over a set of repeated HMI_NODEs
       
    25 
       
    26     arg name="class_name" accepts="string" > HMI_CLASS name
       
    27 
       
    28     path name="root" accepts="HMI_NODE" >  where to find HMI_NODEs whose HMI_CLASS is class_name
       
    29 }
     1 
    30 
     2 widget_defs("ForEach") {
    31 widget_defs("ForEach") {
     3     param "hmi_element";
       
     4 
    32 
     5     if "count(path) != 1" error > ForEach widget «$hmi_element/@id» must have one HMI path given.
    33     if "count(path) != 1" error > ForEach widget «$hmi_element/@id» must have one HMI path given.
     6     if "count(arg) != 1" error > ForEach widget «$hmi_element/@id» must have one argument given : a class name.
    34     if "count(arg) != 1" error > ForEach widget «$hmi_element/@id» must have one argument given : a class name.
     7 
    35 
     8     const "class","arg[1]/@value";
    36     const "class","arg[1]/@value";