* ComboBox.cs: our internal textbox should show selection only if it
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 3 May 2010 22:44:27 +0000 (22:44 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 3 May 2010 22:44:27 +0000 (22:44 -0000)
is enabled. Don't set HideSelection since it's preventing us
from correctly hide the selection when needed. Finally connect a
handler in case our parent ComboBox gets its Enabled state changed.
Fixes #600433.

2010-05-03  Carlos Alberto Cortez <calberto.cortez@gmail.com>

svn path=/trunk/mcs/; revision=156650

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs

index f6b92e076809b1b2b8210fc9ac6b96f1cf2410cf..fb9a63dc8483e18189d8ce7760279b80570a8be9 100644 (file)
@@ -1,3 +1,11 @@
+2010-05-03  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * ComboBox.cs: our internal textbox should show selection only if it
+       is enabled. Don't set HideSelection since it's preventing us
+       from correctly hide the selection when needed. Finally connect a
+       handler in case our parent ComboBox gets its Enabled state changed.
+       Fixes #600433.
+
 2010-05-03  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * TreeView.cs: Set our internal fields related to the starting drag
index 4dbe80a0a13ab80929cd68aa3c8f970e90d30661..bc5ed736096c981d40bd6c8da54264c8b2b44550 100644 (file)
@@ -1117,7 +1117,7 @@ namespace System.Windows.Forms
                        
                        if (textbox_ctrl != null) {
                                textbox_ctrl.SetSelectable (false);
-                               textbox_ctrl.ShowSelection = true;
+                               textbox_ctrl.ShowSelection = Enabled;
                                textbox_ctrl.ActivateCaret (true);
                                textbox_ctrl.SelectAll ();
                        }
@@ -2317,12 +2317,17 @@ namespace System.Windows.Forms
                        {
                                this.owner = owner;
                                ShowSelection = false;
-                               HideSelection = false;
+                               owner.EnabledChanged += OwnerEnabledChangedHandler;
 #if NET_2_0
                                owner.LostFocus += OwnerLostFocusHandler;
 #endif
                        }
 
+                       void OwnerEnabledChangedHandler (object o, EventArgs args)
+                       {
+                               ShowSelection = owner.Focused && owner.Enabled;
+                       }
+
 #if NET_2_0
                        void OwnerLostFocusHandler (object o, EventArgs args)
                        {