[Mono-bugs] [Bug 80209][Nor] New - UserControl.OnEnter, OnLeave are not called when the user clicks on controls

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Dec 9 15:03:12 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=80209

--- shadow/80209	2006-12-09 15:03:12.000000000 -0500
+++ shadow/80209.tmp.19403	2006-12-09 15:03:12.000000000 -0500
@@ -0,0 +1,63 @@
+Bug#: 80209
+Product: Mono: Class Libraries
+Version: 1.2
+OS: other
+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: UserControl.OnEnter, OnLeave are not called when the user clicks on controls
+
+Description of Problem:
+UserControl.OnEnter, OnLeave are not called when the user clicks on 
+controls.
+
+Steps to reproduce the problem:
+1. Compile and run the following program.
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+class TestForm : Form {
+    static void Main() {
+        Application.Run(new TestForm());
+    }
+    public TestForm() {
+        SelectionTestControl 
+         c1 = new SelectionTestControl(),
+         c2 = new SelectionTestControl();
+        c2.Top = c1.Bottom;
+        Controls.AddRange(new Control[] { c1, c2 });
+    }
+    class SelectionTestControl : UserControl {
+        public SelectionTestControl() {
+            BorderStyle = BorderStyle.Fixed3D;
+        }
+        protected override void OnEnter(EventArgs e) {
+            base.OnEnter(e);
+            BackColor = Color.Blue;
+        }
+        protected override void OnLeave(EventArgs e) {
+            base.OnLeave(e);
+            BackColor = DefaultBackColor;
+        }
+    }
+}
+2. Click on the second control.
+
+Actual Results:
+Nothing.
+
+Expected Results:
+The selection indicator (blue background) moves from the first to the 
+second control.
+
+How often does this happen? 
+Always.


More information about the mono-bugs mailing list