diff -r fe945f1f48b7 -r f037e901a17c svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Tue May 18 09:22:17 2021 +0200 +++ b/svghmi/gen_index_xhtml.xslt Tue May 18 09:28:44 2021 +0200 @@ -1,6 +1,6 @@ - - + + @@ -1743,7 +1743,7 @@ - + @@ -5463,21 +5463,21 @@ /* show active */ - this.active_elt.setAttribute("style", this.active_elt_style); + this.active_elt.style.display = ""; /* hide inactive */ - this.inactive_elt.setAttribute("style", "display:none"); + this.inactive_elt.style.display = "none"; } else { /* show inactive */ - this.inactive_elt.setAttribute("style", this.inactive_elt_style); + this.inactive_elt.style.display = ""; /* hide active */ - this.active_elt.setAttribute("style", "display:none"); + this.active_elt.style.display = "none"; } @@ -5485,6 +5485,36 @@ + update_disability() { + + if(this.disabled) { + + /* show disabled */ + + this.disabled_elt.style.display = ""; + + /* hide inactive */ + + this.inactive_elt.style.display = "none"; + + /* hide active */ + + this.active_elt.style.display = "none"; + + } else { + + /* hide disabled */ + + this.disabled_elt.style.display = "none"; + + this.update_activity(); + + } + + } + + + make_on_click() { let that = this; @@ -5493,13 +5523,21 @@ return function(evt){ - /* TODO: suport path pointing to local variable whom value - - would be an HMI_TREE index to jump to a relative page */ - - const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; - - switch_page(name, index); + /* TODO: in order to allow jumps to page selected through for exemple a dropdown, + + support path pointing to local variable whom value + + would be an HMI_TREE index and then jump to a relative page not hard-coded in advance */ + + + + if(!that.disabled) { + + const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; + + switch_page(name, index); + + } } @@ -5517,7 +5555,7 @@ this.active = ((ref_name == undefined || ref_name == page_name) && index == ref_index); - this.update_activity(); + this.update_state(); } @@ -5529,29 +5567,7 @@ this.disabled = !Number(value); - if(this.disabled) { - - /* show disabled */ - - this.disabled_elt.setAttribute("style", this.disabled_elt_style); - - /* hide inactive */ - - this.inactive_elt.setAttribute("style", "display:none"); - - /* hide active */ - - this.active_elt.setAttribute("style", "display:none"); - - } else { - - /* hide disabled */ - - this.disabled_elt.setAttribute("style", "display:none"); - - this.update_activity(); - - } + this.update_state(); } @@ -5587,23 +5603,27 @@ this.element.onclick = this.make_on_click(); - this.active_elt_style = this.active_elt.getAttribute("style"); - - this.inactive_elt_style = this.inactive_elt.getAttribute("style"); - this.activable = true; + + this.unsubscribable = true; + + + this.update_state = - this.disabled_elt_style = this.disabled_elt.getAttribute("style"); - + this.update_disability + + + this.update_activity - this.unsubscribable = true; - + null + ; + }, @@ -7426,9 +7446,9 @@ Made with SVGHMI. https://beremiz.org - + -