[Mono-bugs] [Bug 78542][Nor] New - Problem with Form.ShowDialog () inside a Click event handler.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 30 19:27:38 EDT 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 calberto.cortez at gmail.com.

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

--- shadow/78542	2006-05-30 19:27:38.000000000 -0400
+++ shadow/78542.tmp.19498	2006-05-30 19:27:38.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 78542
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: calberto.cortez at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Problem with Form.ShowDialog () inside a Click event handler.
+
+Description of Problem:
+
+Displaying a Form using ShowDialog () instead of Show () inside a
+Control.Click event handler appears to confuse the event system, and more
+than one form is created.
+
+Steps to reproduce the problem:
+1. Copy the test below and compile.
+2. Click on the blue area (a simple Control instance).
+3. Click on the title bar of the new Form: new Forms will show up.
+
+// Sample
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+public class Test
+{
+        static void Main ()
+        {
+                Form form = new Form ();
+                Control control = new Control ();
+                control.BackColor = Color.AliceBlue; // We need to identify
+the control area
+                control.Location = new Point (15, 15);
+                control.Size = new Size (56, 56);
+                control.Click += OnClick;
+                form.Controls.Add (control);
+
+                Application.Run (form);
+        }
+
+        // Calling form.Show () instead of form.ShowDialog ()
+        // doesn't show any problem
+        static void OnClick (object o, EventArgs args)
+        {
+                Form form = new Form ();
+                form.ShowDialog (); // This line causes the problem
+                form.Close ();
+        }
+}
+// End of sample
+
+
+Actual Results:
+It looks like the event handler is called more than one time per Click.
+
+Expected Results:
+In .Net 2.0 the problem doesn't exist. Just one time the event handler is
+called per Click event.
+
+How often does this happen? 
+Always.
+
+Additional info:
+Mono and libgdiplus from svn.


More information about the mono-bugs mailing list