Author: andreia
Date: 2008-02-07 10:44:27 -0500 (Thu, 07 Feb 2008)
New Revision: 95146
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
Log:
* Control.cs: Reset properties to their pre parent-change values in case
the new parent == null (in which case we're basically removing the control,
and don't want any events fired due to fake property changes)
[Fixes #355850]
2008-02-07 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
2008-02-07 15:22:14 UTC (rev 95145)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-07 15:44:27 UTC (rev 95146)
@@ -1,3 +1,10 @@
+2008-02-07 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * Control.cs: Reset properties to their pre parent-change values in case
+ the new parent == null (in which case we're basically removing the
control,
+ and don't want any events fired due to fake property changes)
+ [Fixes #355850]
+
2008-02-06 Ivan N. Zlatev <[EMAIL PROTECTED]>
* PropertyGridView.cs:
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2008-02-07 15:22:14 UTC (rev 95145)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2008-02-07 15:44:27 UTC (rev 95146)
@@ -32,6 +32,7 @@
#undef DebugRecreate
#undef DebugFocus
+#undef DebugMessages
using System;
using System.ComponentModel;
@@ -1849,6 +1850,18 @@
parent = new_parent;
+ // reset properties back to their pre-parent-change
values if there is
+ // no new parent (i.e., the control is changing parents
because it's
+ // being removed. See #355850)
+ if (parent == null) {
+ is_enabled = pre_enabled;
+ is_visible = pre_visible;
+ font = pre_font;
+ foreground_color = pre_fore_color;
+ background_color = pre_back_color;
+ right_to_left = pre_rtl;
+ }
+
Form frm = this as Form;
if (frm != null) {
frm.ChangingParent (new_parent);
@@ -5119,7 +5132,7 @@
}
protected virtual void WndProc(ref Message m) {
-#if debug
+#if DebugMessages
Console.WriteLine("Control {0} received message {1}",
window.Handle == IntPtr.Zero ? this.Text : XplatUI.Window(window.Handle),
m.ToString ());
#endif
if ((this.control_style &
ControlStyles.EnableNotifyMessage) != 0) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches