Author: andreia
Date: 2006-12-11 12:58:25 -0500 (Mon, 11 Dec 2006)
New Revision: 69338
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs
Log:
TabControl.cs: Set visibility on selected or default tab
when tabcontrol handle is created, so that it's contents
actually show up (duh). Fixes #80193
Don't redraw the control if there is no handle created, as
the selected index might be completely invalid. Added some tests
to check for this.
2006-12-11 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-12-11 17:33:53 UTC (rev 69337)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-12-11 17:58:25 UTC (rev 69338)
@@ -1,3 +1,12 @@
+2006-12-11 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * TabControl.cs: Set visibility on selected or default tab
+ when tabcontrol handle is created, so that it's contents
+ actually show up (duh). Fixes #80193
+ Don't redraw the control if there is no handle created, as
+ the selected index might be completely invalid. Added some tests
+ to check for this.
+
2006-12-11 Everaldo Canuto <[EMAIL PROTECTED]>
* ToolBar.cs: Uses maximun width and height of all buttons as
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
2006-12-11 17:33:53 UTC (rev 69337)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
2006-12-11 17:58:25 UTC (rev 69338)
@@ -441,8 +441,14 @@
protected override void CreateHandle ()
{
base.CreateHandle ();
- if (selected_index >= TabCount)
- selected_index = 0;
+ selected_index = (selected_index >= TabCount ?
(TabCount > 0 ? 0 : -1) : selected_index);
+
+ if (TabCount > 0) {
+ if (selected_index > -1)
+ this.SelectedTab.SetVisible(true);
+ else
+ tab_pages[0].SetVisible(true);
+ }
ResizeTabPages ();
}
@@ -1034,6 +1040,9 @@
internal void Redraw ()
{
+ if (!IsHandleCreated)
+ return;
+
ResizeTabPages ();
Refresh ();
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2006-12-11 17:33:53 UTC (rev 69337)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2006-12-11 17:58:25 UTC (rev 69338)
@@ -1,3 +1,9 @@
+2006-12-11 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * TabControlTest.cs: add tests to check if SelectedIndex is
+ properly set if the TabControl has no pages, before and
+ after the handle is created
+
2006-12-10 Chris Toshok <[EMAIL PROTECTED]>
* ColumnClickEventArgsTest.cs: new tests.
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs
2006-12-11 17:33:53 UTC (rev 69337)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs
2006-12-11 17:58:25 UTC (rev 69338)
@@ -403,10 +403,19 @@
public void NoTabPages ()
{
Form form = new Form ();
- TabControl tc = new TabControl ();
- form.Controls.Add (tc);
+ TabControl tab = new TabControl ();
+ tab.SelectedIndex = 0;
+ Assert.AreEqual (0, tab.SelectedIndex, "#A1");
+
+ form.Controls.Add (tab);
+
+ Assert.AreEqual (0, tab.SelectedIndex, "#A2");
+
form.ShowInTaskbar = false;
form.Show ();
+
+ Assert.AreEqual (-1, tab.SelectedIndex, "#A3");
+
form.Dispose ();
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches