Possible patch for stealing the focus

Mario Sopena <[email protected]>
Newsgroups gmane.comp.gnome.mono.documentation
Message-ID <[email protected]>
Hey,

   I've compiled a possible patch for the bug about stealing the focus
when editing a node
(http://bugzilla.ximian.com/show_bug.cgi?id=76346).

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.

Mario

_______________________________________________
Mono-docs-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-docs-list
browser.cs.diff (text/plain, 662 B)
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;
 		sw.Add(text_editor);
+		text_editor.FocusOutEvent += new FocusOutEventHandler (FocusOut);
 		
 		//
 		// XML editing buttons
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.