# HG changeset patch # User Edouard Tisserant # Date 1654074746 -7200 # Node ID 14d696d7d54e85ffefb318b9395bb462b5d568f0 # Parent e87a2daace80705b24d702fabd486935ec2d11c9 SVHMI: Keyboard: Replace untouched value when typing directly after open. Make info string (HMI variable name) optional. diff -r e87a2daace80 -r 14d696d7d54e svghmi/widget_keypad.ysl2 --- a/svghmi/widget_keypad.ysl2 Wed Jun 01 09:22:07 2022 +0200 +++ b/svghmi/widget_keypad.ysl2 Wed Jun 01 11:12:26 2022 +0200 @@ -30,6 +30,8 @@ on_key_click(symbols) { var syms = symbols.split(" "); this.shift |= this.caps; + if(this.virgin) + this.editstr = ""; this.editstr += syms[this.shift?syms.length-1:0]; this.shift = false; this.update(); @@ -98,16 +100,19 @@ show_modal.call(this,size); this.editstr = String(initial); this.result_callback_obj = callback_obj; - this.Info_elt.textContent = info; + if(this.Info_elt) + this.Info_elt.textContent = info; this.shift = false; this.caps = false; this.initial = initial; this.update(); + this.virgin = true; } update() { if(this.editstr != this._editstr){ + this.virgin = false; this._editstr = this.editstr; this.Value_elt.textContent = this.editstr; } @@ -123,8 +128,8 @@ || widget_defs("Keypad") { - labels("Esc Enter BackSpace Keys Info Value"); - optional_labels("Sign Space NumDot"); + labels("Esc Enter BackSpace Keys Value"); + optional_labels("Sign Space NumDot Info"); activable_labels("CapsLock Shift"); | init: function() { foreach "$hmi_element/*[@inkscape:label = 'Keys']/*" { @@ -138,4 +143,5 @@ | const "g", "$geometry[@Id = $hmi_element/@id]"; | coordinates: [«$g/@x», «$g/@y»], + | virgin: false, }