svghmi/widget_keypad.ysl2
changeset 3508 14d696d7d54e
parent 3241 fe945f1f48b7
child 3520 b27e50143083
--- 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,
 }