--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/widget_multistate.ysl2 Wed Aug 05 15:16:43 2020 +0200
@@ -0,0 +1,60 @@
+// widget_multistate.ysl2 +template "widget[@type='MultiState']", mode="widget_class" + class MultiStateWidget extends Widget{ + for(let choice of this.choices){ + if(this.state != choice.value){ + choice.elt.setAttribute("style", "display:none"); + choice.elt.setAttribute("style", choice.style); + //get current selected value + for(next_ind=0; next_ind<this.choices.length; next_ind++){ + if(this.state == this.choices[next_ind].value){ + next_ind = next_ind + 1; + //get next selected value + if(this.choices.length > next_ind){ + this.state = this.choices[next_ind].value; + this.state = this.choices[0].value; + change_hmi_value(this.indexes[0], "="+this.state); + this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)"); +template "widget[@type='MultiState']", mode="widget_defs" { + const "regex",!"'^(\"[^\"].*\"|\-?[0-9]+|false|true)(#.*)?$'"!; + foreach "$result_svg_ns//*[@id = $hmi_element/@id]//*[regexp:test(@inkscape:label,$regex)]" { + const "literal", "regexp:match(@inkscape:label,$regex)[2]"; + | }`if "position()!=last()" > ,` \ No newline at end of file