diff -r 608f48ad3dfc -r ecefd38d5c7d svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Mon Nov 08 14:09:44 2021 +0100 +++ b/svghmi/gen_index_xhtml.xslt Mon Nov 08 14:10:36 2021 +0100 @@ -572,7 +572,7 @@ - + @@ -846,7 +846,7 @@ - + @@ -4583,7 +4583,7 @@ - Documentation to be written. see svbghmi exemple. + Documentation to be written. see svghmi exemple. @@ -4833,13 +4833,13 @@ id(" - ").setAttribute("xlink:href", + ").href.baseVal = "#"+hmi_widgets[" "].items[ - ]); + ]; @@ -5675,9 +5675,9 @@ items: { - + " - : " + ": " ", @@ -5685,6 +5685,60 @@ }, + + + + + + ListSwitch widget displays one item of an HMI:List depending on value of + + given variable. Main element of the widget must be a clone of the list or + + of an item of that list. + + + + Given variable's current value is compared to list items + + label. For exemple if given variable type + + is HMI_INT and value is 1, then item with label '1' will be displayed. + + If matching variable of type HMI_STRING, then no quotes are needed. + + For exemple, 'hello' match HMI_STRING 'hello'. + + + + Displays item of an HMI:List whose label matches value. + + + value to compare to labels + + + + class + ListSwitchWidget + extends Widget{ + + frequency = 5; + + } + + + + + + + dispatch: function(value) { + + this.element.href.baseVal = "#"+hmi_widgets[" + + "].items[value]; + + }, + + @@ -7239,7 +7293,7 @@ - Show elements whose label match value. + Show elements whose label matches value. value to compare to labels @@ -8432,6 +8486,8 @@ // subscribe to per instance current page hmi variable + // PLC must prefix page name with "!" for page switch to happen + subscribers(current_page_var_index).add({ frequency: 1, @@ -8440,7 +8496,9 @@ new_hmi_value: function(index, value, oldval) { - switch_page(value); + if(value.startsWith("!")) + + switch_page(value.slice(1)); } @@ -8946,13 +9004,11 @@ - apply_hmi_value(current_page_var_index, - - page_index == undefined - - ? page_name - - : page_name + "@" + hmitree_paths[page_index]); + apply_hmi_value(current_page_var_index, page_index == undefined + + ? page_name + + : page_name + "@" + hmitree_paths[page_index]);