Browse Source

* TabPage.cs: Ignore setting of Visible, and add an internal
method for setting the controls visibility. TabPage's Visible
property is a little strange on MS, this seems to make us
compatible, and fixes cases where people set all the tab pages
to
visible.
* TabControl.cs: Use the new internal setting on tab pages
visibility.


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

Jackson Harper 19 years ago
parent
commit
2dfdbfe90f

+ 10 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,13 @@
+2006-10-04  Jackson Harper  <[email protected]>
+
+	* TabPage.cs: Ignore setting of Visible, and add an internal
+	method for setting the controls visibility.  TabPage's Visible
+	property is a little strange on MS, this seems to make us
+	compatible, and fixes cases where people set all the tab pages to
+	visible.
+	* TabControl.cs: Use the new internal setting on tab pages
+	visibility.
+
 2006-10-03  Mike Kestner  <[email protected]>
 
 	* ComboBox.cs : raise Click on ComboTextBox clicks. Fixes #79555.

+ 5 - 4
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs

@@ -242,7 +242,7 @@ namespace System.Windows.Forms {
 				if (selected_index != -1) {
 					if (!refresh)
 						invalid = GetTabRect (selected_index);
-					Controls [selected_index].Visible = false;
+					((TabPage) Controls [selected_index]).SetVisible (false);
 				}
 				selected_index = value;
 
@@ -253,7 +253,7 @@ namespace System.Windows.Forms {
 				if (selected_index != -1) {
 					selected = (TabPage) Controls [selected_index];
 					invalid = Rectangle.Union (invalid, GetTabRect (selected_index));
-					selected.Visible = true;
+					selected.SetVisible (true);
 				}
 
 				ResumeLayout ();
@@ -1052,12 +1052,13 @@ namespace System.Windows.Forms {
 
 			public override void Add (Control value)
 			{
-				if (!(value is TabPage))
+				TabPage page = value as TabPage;
+				if (page == null)
 					throw new ArgumentException ("Cannot add " +
 						value.GetType ().Name + " to TabControl. " +
 						"Only TabPages can be directly added to TabControls.");
 
-				value.Visible = false;
+				page.SetVisible (false);
 				base.Add (value);
 				if (Count == 1) {
 					owner.SelectedIndex = 0;

+ 6 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs

@@ -149,7 +149,7 @@ namespace System.Windows.Forms {
 		[EditorBrowsable(EditorBrowsableState.Never)]
 		public new bool Visible {
 			get { return base.Visible; }
-			set { base.Visible = value; }
+			set { /* according to MS docs we can ignore this */ }
 		}
 
 		#endregion	// Public Instance Properties
@@ -201,6 +201,11 @@ namespace System.Windows.Forms {
 			get { return base.Parent as TabControl; }
 		}
 
+		internal void SetVisible (bool value)
+		{
+			base.Visible = value;
+		}
+
 		#endregion	// Internal & Private Methods and Properties
 
 		#region Protected Instance Methods