[Mono-docs-list] Possible patch for stealing the focus

Mario Sopena mario.sopena at gmail.com
Wed Oct 12 04:52:34 EDT 2005


   I've compiled a possible patch for the bug about stealing the focus
when editing a node

The point is that the bug is hard to reproduce (at least, here occurs
only few times), so it's hard to say the patch solved the bug. Does
this bug happens often to you?? Please, try the patch and tell me if
it corrects the bug.

Another thing is that I'm not sure the approach is valid, since it
makes the text area like a modal widget that has always the keyboard
focus while in edit mode. I think there is no problem with that, but
I'm not 100% confident, so I want your opinions.

-------------- next part --------------
Index: browser.cs
--- browser.cs	(revision 51504)
+++ browser.cs	(working copy)
@@ -2184,6 +2184,12 @@
 	public System.Xml.XmlNode edit_node;
 	public string edit_url;
+	void FocusOut (object sender, FocusOutEventArgs args)
+	{
+		if (TabMode == Mode.Editor)
+			text_editor.GrabFocus ();	
+	}
 	public Tab(Browser br) 
@@ -2255,6 +2261,7 @@
 		text_editor.Buffer.Changed += new EventHandler (EditedTextChanged);
 		text_editor.WrapMode = WrapMode.Word;
+		text_editor.FocusOutEvent += new FocusOutEventHandler (FocusOut);
 		// XML editing buttons

More information about the Mono-docs-list mailing list