Input widget takes one variable path, and displays current value in
optional "value" labeled sub-element.
Click on optional "edit" labeled element opens keypad to edit value.
Operation on current value is performed when click on sub-elements with
label starting with '=', '+' or '-' sign. Value after sign is used as
shortdesc > Input field with predefined operation buttons
arg name="format" accepts="string" > optional printf-like format
path name="edit" accepts="HMI_INT, HMI_REAL, HMI_STRING" > single variable to edit
this.change_hmi_value(0, opstr);
this.apply_hmi_value(0, new_val);
this.is_inhibited = true;
setTimeout(() => this.stopalert(), 1000);
this.is_inhibited = false;
this.display = this.last_value;
undershot(new_val, min) {
const "value_elt" optional_labels("value");
const "have_value","string-length($value_elt)>0";
const "edit_elt" optional_labels("edit");
const "have_edit","string-length($edit_elt)>0";
const "action_elements", "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]";
| dispatch: function(value) {
if "$have_value or $have_edit" {
| this.last_value = vsprintf("«arg[1]/@value»", [value]);
| this.last_value = value;
| if(!this.is_inhibited){
| this.display = this.last_value;
| this.request_animate();
| multiline_to_svg_text(this.value_elt, String(this.display));
foreach "$action_elements" {
| action_elt_«position()»: id("«@id»"),
| this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_value);
| this.value_elt.style.pointerEvents = "none";
foreach "$action_elements" {
| this.action_elt_«position()».onclick = () => this.on_op_click("«func:escape_quotes(@inkscape:label)»");
| multiline_to_svg_text(this.value_elt, "");