Author: andreia
Date: 2006-11-22 23:20:48 -0500 (Wed, 22 Nov 2006)
New Revision: 68380

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
Log:
* NumericUpDown: 
- Fix DecimalPlaces, Hexadecimal and ThousandsSeparator to 
update inner values on set. Fixes #79966.
- Override OnLostFocus to update value on NET 2. Fixes #79950.
- Fix hexadecimal parsing.

* UpDownBase: Override OnGotFocus and OnLostFocus to notify 
parent. Fixes #79957

2006-11-22  Andreia Gaita  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-23 01:22:58 UTC (rev 68379)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-23 04:20:48 UTC (rev 68380)
@@ -1,3 +1,14 @@
+2006-11-22  Andreia Gaita  <[EMAIL PROTECTED]>
+
+       * NumericUpDown: 
+       - Fix DecimalPlaces, Hexadecimal and ThousandsSeparator to 
+       update inner values on set. Fixes #79966.
+       - Override OnLostFocus to update value on NET 2. Fixes #79950.
+       - Fix hexadecimal parsing.
+       
+       * UpDownBase: Override OnGotFocus and OnLostFocus to notify 
+       parent. Fixes #79957
+
 2006-11-22  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
 
        * Control.cs: After calling SetWindowsPos in SetBoundsCore 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs 
2006-11-23 01:22:58 UTC (rev 68379)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs 
2006-11-23 04:20:48 UTC (rev 68380)
@@ -151,9 +151,7 @@
 
                        set {
                                decimal_places = value;
-                               if (!UserEdit) {
-                                       UpdateEditText();
-                               }
+                               UpdateEditText();
                        }
                }
 
@@ -165,9 +163,7 @@
 
                        set {
                                hexadecimal = value;
-                               if (!UserEdit) {
-                                       UpdateEditText();
-                               }
+                               UpdateEditText();
                        }
                }
 
@@ -242,10 +238,7 @@
 
                        set {
                                thousands_separator = value;
-
-                               if (!UserEdit) {
-                                       UpdateEditText();
-                               }
+                               UpdateEditText();
                        }
                }
 
@@ -344,18 +337,13 @@
                        try {
                                string user_edit_text = Text;
 
-                               if (!hexadecimal) {
-                                       dvalue = decimal.Parse(user_edit_text, 
CultureInfo.CurrentCulture);
-                               } else {
-                                       dvalue = 0M;
+                if (!hexadecimal) {
+                    dvalue = decimal.Parse(user_edit_text, 
CultureInfo.CurrentCulture);
+                }
+                else {
+                    dvalue = Convert.ToDecimal(Convert.ToInt32(user_edit_text, 
10));
+                }
 
-                                       for (int i=0; i < 
user_edit_text.Length; i++) {
-                                               int hex_digit = 
Convert.ToInt32(user_edit_text.Substring(i, 1), 16);
-
-                                               dvalue = unchecked(dvalue * 16M 
+ (decimal)hex_digit);
-                                       }
-                               }
-
                                if (dvalue < minimum) {
                                        dvalue = minimum;
                                }
@@ -458,6 +446,14 @@
                        ParseEditText();
                        UpdateEditText();
                }
+
+#if NET_2_0
+        protected override void OnLostFocus(EventArgs e) {
+            base.OnLostFocus(e);
+            if (this.UserEdit)
+                this.UpdateEditText();
+        }
+#endif
                #endregion      // Protected Instance Methods
 
                #region Events

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs    
2006-11-23 01:22:58 UTC (rev 68379)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs    
2006-11-23 04:20:48 UTC (rev 68380)
@@ -252,6 +252,13 @@
                                else
                                        document.CaretLostFocus ();
                        }
+            protected override void OnGotFocus(EventArgs e) {
+                this.parent.OnGotFocusInternal(e);
+            }
+
+            protected override void OnLostFocus(EventArgs e) {
+                this.parent.OnLostFocusInternal(e);
+            }
                }
 
                #region Local Variables

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to