svghmi/widget_jump.ysl2
branchsvghmi
changeset 2900 3ef217f525ff
parent 2898 a2910281fcb5
child 2901 3f5194bba67d
equal deleted inserted replaced
2899:f1baf2d0552c 2900:3ef217f525ff
     1 // widget_jump.ysl2
     1 // widget_jump.ysl2
     2 
     2 
     3 template "widget[@type='Jump']", mode="widget_defs" {
     3 template "widget[@type='Jump']", mode="widget_defs" {
     4     param "hmi_element";
     4     param "hmi_element";
       
     5 
       
     6     /* check that given path is compatible with page's reference path */
       
     7     if "count(arg) > 0 and count(path) > 0" {
       
     8         const "target_page_name", "arg[1]/@value";
       
     9         const "target_page_desc", "$hmi_pages_descs[arg[1]/@value = $target_page_name]";
       
    10         const "target_page_path", "$target_page_desc/path[1]/@value";
       
    11         if "not(func:same_class_paths($target_page_path, path[1]/@value))"
       
    12             warning > Jump id="«@id»" to page "«$target_page_name»" with incompatible path "«path[1]/@value»"
       
    13     }
       
    14     /* TODO check that path is also matching in case of implicit local jump (no page name given) */
       
    15 
     5     |     on_click: function(evt) {
    16     |     on_click: function(evt) {
     6     |         const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
    17     |         const index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
     7     |         switch_page(this.args[0], index);
    18     |         switch_page(this.args[0], index);
     8     |     },
    19     |     },
     9     |     init: function() {
    20     |     init: function() {