[Mono-bugs] [Bug 78486][Min] Changed - ContainerControl should move focus to the child or the next control when it received focus

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jul 13 00:35:27 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 atsushi at ximian.com.

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

--- shadow/78486	2006-07-11 18:24:45.000000000 -0400
+++ shadow/78486.tmp.966	2006-07-13 00:35:27.000000000 -0400
@@ -1,23 +1,23 @@
 Bug#: 78486
 Product: Mono: Class Libraries
 Version: 1.1
 OS: unknown
 OS Details: 
-Status: RESOLVED   
-Resolution: FIXED
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Minor
 Component: Windows.Forms
 AssignedTo: peter at novonyx.com                            
 ReportedBy: atsushi at ximian.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: [PATCH] ContainerControl should not receive focus
+Summary: ContainerControl should move focus to the child or the next control when it received focus
 BugsThisDependsOn: 78674
 
 The following example demonstrates that either UserControl or Form steals a
 focus from its child Button:
 
 using System;
@@ -130,6 +130,73 @@
 
 ------- Additional Comments From peter at novonyx.com  2006-06-21 12:23 -------
 Grr. I wish I could type. Attached to the wrong bug
 
 ------- Additional Comments From jackson at ximian.com  2006-07-11 18:24 -------
 Fixed in SVN.
+
+------- Additional Comments From atsushi at ximian.com  2006-07-13 00:35 -------
+Am reopening this bug as the primary problem on this bug is not gone
+yet. Though as Peter pointed out that container controls should
+receive focus, the container control should not hold the focus to
+itself. The modified example code shows you how the focus is transferred.
+
+using System;
+using System.Windows.Forms;
+
+public class Test : Form
+{
+	public static void Main ()
+	{
+		Application.Run (new Test ());
+	}
+
+	public Test ()
+	{
+		GotFocus += delegate (object o, EventArgs e) {
+			Console.WriteLine (DateTime.Now.Ticks / 1000 + " Form got focus");
+		};
+		ContainerControl c = new ContainerControl ();
+		c.GotFocus += delegate (object o, EventArgs e) {
+			Console.WriteLine (DateTime.Now.Ticks / 1000 + " my control got
+focus.");
+		};
+		Controls.Add (c);
+		Button mb = new Button ();
+		mb.GotFocus += delegate (object o, EventArgs e) {
+			Console.WriteLine (DateTime.Now.Ticks / 1000 + " button got focus.");
+		};
+		Controls.Add (mb);
+		Button b = new Button ();
+		b.GotFocus += delegate (object o, EventArgs e) {
+			Console.WriteLine (DateTime.Now.Ticks / 1000 + " internal button
+got focus.");
+		};
+		c.Controls.Add (b);
+	}
+}
+
+Hit tabs.
+
+On .NET, the focus on the visible button is two for one. Note that my
+control immediately transfers the focus to button.
+
+./78486.exe
+632883914478263 button got focus.
+632883914487376 button got focus.
+632883914497891 my control got focus.
+632883914497891 internal button got focus.
+632883914507205 button got focus.
+632883914516117 my control got focus.
+632883914516117 internal button got focus.
+
+On .NET, it is three for one.
+
+mono ./78486.exe
+Mono System.Windows.Forms Assembly [$auto_build_revision$]
+632883914858200 internal button got focus.
+632883914858300 my control got focus.
+632883914868720 internal button got focus.
+632883914877830 button got focus.
+632883914888350 my control got focus.
+632883914897060 internal button got focus.
+


More information about the mono-bugs mailing list