Ver Fonte

Added ImmediateUpdates option to TextBoxEditor and MemoEditor controls

frankvandenbos há 6 meses atrás
pai
commit
62090a9f47

+ 3 - 0
InABox.Core/Objects/Editors/MemoEditor.cs

@@ -5,10 +5,13 @@
         
         public double Height { get; set; }
         
+        public bool ImmediateUpdates { get; set; } = true;
+        
         protected override BaseEditor DoClone()
         {
             var result = new MemoEditor();
             result.Height = Height;
+            result.ImmediateUpdates = ImmediateUpdates;
             return result;
         }
     }

+ 8 - 1
InABox.Core/Objects/Editors/TextBoxEditor.cs

@@ -8,10 +8,17 @@
         }
 
         public EditorButton[]? Buttons { get; set; }
+        
+        public bool ImmediateUpdates { get; set; } = true;
 
         protected override BaseEditor DoClone()
         {
-            return new TextBoxEditor { Buttons = Buttons };
+            return new TextBoxEditor()
+            { 
+                Buttons = Buttons, 
+                ImmediateUpdates = ImmediateUpdates
+                
+            };
         }
     }
 }

+ 4 - 1
inabox.wpf/DynamicGrid/Editors/MemoEditor/MemoEditorControl.cs

@@ -42,11 +42,14 @@ namespace InABox.DynamicGrid
                 AcceptsReturn = true,
                 
             };
+            
             Editor.TextChanged += (o, e) =>
             {
                 IsChanged = true;
-                CheckChanged();
+                if (EditorDefinition.ImmediateUpdates)
+                    CheckChanged();
             };
+        
             Editor.LostFocus += (o, e) =>
             {
                 if (IsChanged)

+ 5 - 1
inabox.wpf/DynamicGrid/Editors/TextBoxEditor/TextBoxEditorControl.cs

@@ -46,14 +46,18 @@ public class TextBoxEditorControl : DynamicEditorControl<string, TextBoxEditor>
             Editor.IsEnabled = false;
         }
 
+        
         Editor.TextChanged += (o, e) =>
         {
             if (Loaded)
             {
                 IsChanged = true;
-                CheckChanged();
+                if (EditorDefinition.ImmediateUpdates)
+                    CheckChanged();
             }
         };
+
+
         Editor.LostFocus += (o, e) =>
         {
             if (IsChanged)