[Mono-bugs] [Bug 80180][Nor] New - Clicking a button that was assigned to CancelButton does not close the form

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Dec 7 14:10:29 EST 2006


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=80180

--- shadow/80180	2006-12-07 14:10:29.000000000 -0500
+++ shadow/80180.tmp.29628	2006-12-07 14:10:29.000000000 -0500
@@ -0,0 +1,61 @@
+Bug#: 80180
+Product: Mono: Class Libraries
+Version: 1.2
+OS: Windows XP
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: georgegiolfan at yahoo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Clicking a button that was assigned to CancelButton does not close the form
+
+Description of Problem:
+Clicking a button that was assigned to CancelButton does not close the 
+form.
+
+Steps to reproduce the problem:
+1. Compile and run the following program.
+using System.Windows.Forms;
+class TestForm : Form {
+    static void Main() {
+        new TestForm().ShowDialog();
+    }
+    public TestForm() {
+        Button b = new Button();
+        CancelButton = b;
+        Controls.Add(b);
+    }
+}
+2. Click the button.
+
+Actual Results:
+Nothing.
+
+Expected Results:
+The form should close.
+
+How often does this happen? 
+Always.
+
+Additional Information:
+
+Microsoft .NET Framework seems to change DialogResult to Cancel. I suggest 
+to do the same (in Form.cs):
+		public IButtonControl CancelButton {
+			get {
+				return cancel_button;
+			}
+
+			set {
+				cancel_button = value;
+				// Add this line
+				cancel_button.DialogResult = DialogResult.Cancel;
+			}
+		}


More information about the mono-bugs mailing list