/[RomCheater]/trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs
ViewVC logotype

Diff of /trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs	2013/06/17 05:19:32	670
+++ trunk/Win32/libWin32/Win32/UI/MaskedHexBox.cs	2013/06/17 05:29:37	671
@@ -13,6 +13,7 @@
     [DefaultEvent("ValueChanged")]
     public partial class MaskedHexBox : UserControl
     {
+        ulong old_value = 0;
         public MaskedHexBox()
         {
             InitializeComponent();
@@ -46,7 +47,11 @@
             if (e.KeyCode > Keys.F && e.KeyCode <= Keys.Z && !e.Control && !e.Alt)
             {
                 e.SuppressKeyPress = true;
-            }            
+            }
+            if (!e.SuppressKeyPress)
+            {
+                old_value = this.Value;
+            }
         }
 
         new public Font Font
@@ -78,15 +83,26 @@
         }
         public override string Text
         {
-            get { return txtMaskedHexBox.Text.PadRight(this.TextLength + 2, '0'); }
-            set { txtMaskedHexBox.Text = value; DoResize(); }
+            get
+            {
+                return txtMaskedHexBox.Text.PadRight(this.TextLength + 2, '0');
+            }
+            set
+            {
+                old_value = this.Value;
+                txtMaskedHexBox.Text = value;
+                DoResize();
+                ulong new_value = this.Value;
+                if ((new_value != old_value) && ValueChanged != null)
+                    ValueChanged(this, new ValueChangedEventArgs(old_value, new_value));
+            }
         }
         public ulong Value
         {
             get { return this.ToUInt64(); }
             set
             {
-                ulong old_value = this.Value;
+               
                 switch (this.TextLength)
                 {
                     case 0:
@@ -99,10 +115,7 @@
                     case 7:
                     case 8: this.Text = string.Format("0x{0:x8}", value); break;
                     default: this.Text = string.Format("0x{0:x" + this.TextLength + "}", value); break;
-                }
-                ulong new_value = this.Value;
-                if ((new_value!= old_value) && ValueChanged != null)
-                    ValueChanged(this, new ValueChangedEventArgs(old_value, new_value));
+                }               
             }
         }
         private bool _isAddressMask;
@@ -250,6 +263,13 @@
                 
             }
         }
+
+        private void txtMaskedHexBox_TextChanged(object sender, EventArgs e)
+        {           
+            ulong new_value = this.Value;
+            if ((new_value != old_value) && ValueChanged != null)
+                ValueChanged(this, new ValueChangedEventArgs(old_value, new_value));
+        }
     }
 
     #region MaskedHexBox Extensions

 

  ViewVC Help
Powered by ViewVC 1.1.22