diff -r ae8063127e95 -r 8927ae8326b2 svghmi/widget_foreach.ysl2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/widget_foreach.ysl2 Fri Mar 20 10:46:15 2020 +0100 @@ -0,0 +1,28 @@ + +template "widget[@type='ForEach']", mode="widget_defs" { + param "hmi_element"; + | frequency: 2, + | dispatch: function(value) { + | // do something + | }, + | init: function() { + foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" { + | id("«@id»").addEventListener( + | "click", + | evt => {let new_val = "«func:escape_quotes(@inkscape:label)»"); + | // do something with new_val + | }); + } + | }, +} + +template "widget[@type='ForEach']", mode="widget_subscribe"{ + // param "hmi_element"; + | sub: function(off){ + | subscribe.call(this,off) + | }, + + | unsub: function(){ + | unsubscribe.call(this) + | }, +}