Author: jpobst
Date: 2007-09-11 16:52:40 -0400 (Tue, 11 Sep 2007)
New Revision: 85662

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs
Log:
2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

        * Control.cs: Provide a setter for ExplicitHeight.
        * TextBoxBase.cs: Now that we have the implementation for explicit 
heights,
        remove the hacks in here for requested_height.
        [Fixes bug #82749]

2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

        * TextBoxTest.cs: Add test for bug #82749.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-09-11 20:52:16 UTC (rev 85661)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-09-11 20:52:40 UTC (rev 85662)
@@ -1,5 +1,12 @@
 2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
 
+       * Control.cs: Provide a setter for ExplicitHeight.
+       * TextBoxBase.cs: Now that we have the implementation for explicit 
heights,
+       remove the hacks in here for requested_height.
+       [Fixes bug #82749]
+
+2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
+
        * ScrollBar.cs: Fix an issue reported on the lists where setting a 
scrollbar's
        Maximum to lower that its current Value caused an ArgumentException by 
setting
        the Value to the new Maximum.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-09-11 20:52:16 UTC (rev 85661)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-09-11 20:52:40 UTC (rev 85662)
@@ -1177,7 +1177,7 @@
                
                internal Size InternalClientSize { set { this.client_size = 
value; } }
                internal virtual bool ActivateOnShow { get { return true; } }
-               internal Rectangle ExplicitBounds { get { return 
this.explicit_bounds; } }
+               internal Rectangle ExplicitBounds { get { return 
this.explicit_bounds; } set { this.explicit_bounds = value; } }
                #endregion      // Internal Properties
 
                #region Private & Internal Methods

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs   
2007-09-11 20:52:16 UTC (rev 85661)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs   
2007-09-11 20:52:40 UTC (rev 85662)
@@ -72,7 +72,6 @@
 
                internal int                    selection_length = -1;  // set 
to the user-specified selection length, or -1 if none
                internal bool show_caret_w_selection;  // TextBox shows the 
caret when the selection is visible
-               internal int                    requested_height;
                internal int                    canvas_width;
                internal int                    canvas_height;
                static internal int             track_width = 2;        //
@@ -114,7 +113,6 @@
                        document.HeightChanged += new 
EventHandler(document_HeightChanged);
                        //document.CaretMoved += new EventHandler(CaretMoved);
                        document.Wrap = false;
-                       requested_height = -1;
                        click_last = DateTime.Now;
                        click_mode = CaretSelection.Position;
                        bmp = new Bitmap(1, 1, 
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
@@ -453,12 +451,11 @@
                        set {
                                if (value != document.multiline) {
                                        document.multiline = value;
-                                       // Make sure we update our size; the 
user may have already set the size before going to multiline
-                                       if (document.multiline && 
requested_height != -1) {
-                                               Height = requested_height;
-                                               requested_height = -1;
-                                       }
 
+                                       // SetBoundsCore overrides the Height 
for multiline if it needs to,
+                                       // so we don't need to worry about it 
here.
+                                       SetBoundsCore (Left, Top, Width, 
ExplicitBounds.Height, BoundsSpecified.None);
+                                       
                                        if (Parent != null)
                                                Parent.PerformLayout ();
 
@@ -1413,7 +1410,15 @@
                        if (!richtext) {
                                if (!document.multiline) {
                                        if (height != PreferredHeight) {
-                                               requested_height = height;
+                                               // If the specified has Height, 
we need to store that in the
+                                               // ExplicitBounds because we 
are going to override it
+                                               if ((specified & 
BoundsSpecified.Height) != 0) {
+                                                       Rectangle r = 
ExplicitBounds;
+                                                       r.Height = height;
+                                                       ExplicitBounds = r;
+                                                       specified &= 
~BoundsSpecified.Height;
+                                               }
+                                               
                                                height = PreferredHeight;
                                        }
                                }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-09-11 20:52:16 UTC (rev 85661)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-09-11 20:52:40 UTC (rev 85662)
@@ -1,5 +1,9 @@
 2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
 
+       * TextBoxTest.cs: Add test for bug #82749.
+
+2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
+
        * ControlTest.cs: Add test for bug #82748.
 
 2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs  
    2007-09-11 20:52:16 UTC (rev 85661)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs  
    2007-09-11 20:52:40 UTC (rev 85662)
@@ -699,6 +699,31 @@
                }
                
                [Test]
+               public void Bug82749 ()
+               {
+                       Form f = new Form ();
+                       f.ShowInTaskbar = false;
+
+                       TextBox _textBox = new TextBox ();
+                       _textBox.Dock = DockStyle.Top;
+                       _textBox.Height = 100;
+                       _textBox.Multiline = true;
+                       f.Controls.Add (_textBox);
+                       
+                       f.Show ();
+                       Assert.AreEqual (100, _textBox.Height, "A1");
+                       
+                       // Depends on font height, but it should be less than 25
+                       _textBox.Multiline = false;
+                       Assert.IsTrue (_textBox.Height < 25, "A2");
+
+                       _textBox.Multiline = true;
+                       Assert.AreEqual (100, _textBox.Height, "A3");
+                       
+                       f.Close ();
+                       f.Dispose ();
+               }
+               [Test]
                public void ModifiedTest ()
                {
                        Assert.AreEqual (true, textBox.Modified, "modified-1");

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

Reply via email to