[Mono-bugs] [Bug 79384][Nor] Changed - ContainerControl: When got focus, it should pass it to its first child control

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Sep 12 14:54:20 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 unserkonig at gmail.com.

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

--- shadow/79384	2006-09-12 14:12:59.000000000 -0400
+++ shadow/79384.tmp.22433	2006-09-12 14:54:20.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 79384
 Product: Mono: Class Libraries
 Version: 1.1
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: Windows.Forms
 AssignedTo: toshok at ximian.com                            
 ReportedBy: unserkonig at gmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -31,6 +31,59 @@
 
 Expected Results:
 When focus is given to Container class fom the "hi" button, the focus
 sequence should be: 1) Container.OnGotFocus 2) Container.OnLostFocus 3)
 ChildControl.OnGotFocus. We can see this based on the messages printed to
 the console.
+
+------- Additional Comments From unserkonig at gmail.com  2006-09-12 14:54 -------
+// Sample
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+
+public class TestForm : Form
+{
+	static void Main ()
+	{
+		TestForm form = new TestForm ();
+		Application.Run (form);
+	}
+	public TestForm ()
+	{
+		// Add handlers for focus events
+		ContainerControl container = new ContainerControl ();
+		container.Parent = this;
+		container.Location = new Point (5, 5);
+		container.Size = new Size (90, 50);
+		container.GotFocus += ControlGotFocus;
+		container.LostFocus += ControlLostFocus;
+
+		// This button goes inside the ContainerControl
+		// and we add handlers for the focus events
+		Button b1 = new Button ();
+		b1.Text = "I'm in a container";
+		b1.Dock = DockStyle.Fill;
+		b1.Parent = container;
+		b1.GotFocus += ControlGotFocus;
+		b1.LostFocus += ControlLostFocus;
+
+		// This let us test focus changes
+		Button b2 = new Button ();
+		b2.Text = "hi";
+		b2.Location = new Point (5, container.Bottom + 5);
+		b2.Parent = this;
+	}
+
+	void ControlGotFocus (object o, EventArgs a)
+	{
+		Type t = o.GetType ();
+		Console.WriteLine (t.Name + " :: GotFocus");
+	}
+
+	void ControlLostFocus (object o, EventArgs a)
+	{
+		Type t = o.GetType ();
+		Console.WriteLine (t.Name + " :: LostFocus");
+	}
+}
+


More information about the mono-bugs mailing list