[Mono-bugs] [Bug 80590][Cos] New - TextBox.ForeColor behavior when ReadOnly is true

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 23 17:41:53 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by georgegiolfan at yahoo.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80590

--- shadow/80590	2007-01-23 17:41:53.000000000 -0500
+++ shadow/80590.tmp.2334	2007-01-23 17:41:53.000000000 -0500
@@ -0,0 +1,65 @@
+Bug#: 80590
+Product: Mono: Class Libraries
+Version: 1.2
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Cosmetic
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: georgegiolfan at yahoo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: TextBox.ForeColor behavior when ReadOnly is true
+
+Steps to reproduce the problem:
+1. Compile and run the following program on MS SWF.
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+class TestForm : Form {
+    static void Main() {
+        Application.Run(new TestForm());
+    }
+    TextBox t = new TextBox();
+    public TestForm() {
+        t.ForeColor = Color.Red;
+        t.Text = "Test";
+        t.ReadOnly = true;
+        Controls.Add(t);
+    }
+    protected override void OnClick(EventArgs e) {
+        base.OnClick(e);
+        // This looks stupid. However, without this line, the following 
+would not work.
+        t.BackColor = t.BackColor;
+        t.ForeColor = Color.Red;
+    }
+}
+2. Notice how setting ForeColor (in the constructor) had no efect.
+3. Click in the text box so that the text is no longer selected.
+4. Click on the form.
+5. Notice that the color on the text did not change.
+6. Select the text and then deselect it to see the color change.
+
+Actual Results:
+ForeColor behaves as expected!
+
+Expected Results:
+ForeColor behaves in a completely unexpected way!
+
+How often does this happen? 
+Always (on the SVN version).
+
+Additional Information:
+I'm not even sure if this should be fixed. This is probably another one of 
+those strange things in the Microsoft implementation caused by the fact 
+that many controls in SWF are just wrappers around existing Windows 
+controls. However, I imagine one would use such tricks in order to get the 
+desired effect on MS SWF and that application may perform useless changes 
+to ForeColor, BackColor, Invalidate, etc. Maybe this MWF behavior should 
+be documented if it is left as it is now.


More information about the mono-bugs mailing list