[Mono-bugs] [Bug 80976][Wis] New - User Control Focus can never get focus again

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Feb 27 13:41:51 EST 2007

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 eric at rengeo.com.


--- shadow/80976	2007-02-27 13:41:51.000000000 -0500
+++ shadow/80976.tmp.31137	2007-02-27 13:41:51.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 80976
+Product: Mono: Class Libraries
+Version: 1.2
+OS Details: SuSE 10.1
+Status: NEW   
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: eric at rengeo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: User Control Focus can never get focus again
+Description of Problem:
+When you have a button in a control, which is put into another user
+control, and that user control is put on a form, getting focus is screwy. 
+Once a button on that user control gets gets focus, and loses focus, it can
+never get focus again.  I've dove into the code a little bit, and it looks
+like when the Control is trying to set focus, is_focusing is set to true,
+select() botches, and is_focusing is forever set to true.  Thus, that
+control can never get focus again, because is_focusing must be false for it
+to even try to give focus to the control.
+I've also tried bypassing the .Focus() function by just calling .Select(),
+and it doesn't work.  Expected, since the previous code would work, if
+.Select() could set focus to the control...
+Steps to reproduce the problem:
+1. Compile and run attached test case.
+mcs -r:System.Windows.Forms -r:System.Data -r:System.Drawing Form1.cs
+HotKey.cs HotKeyControl.cs
+mono Form1.exe
+2. Mouse over the buttons in the tab control on the form.
+Actual Results:
+Background colors change just fine, but the focus box never returns to the
+buttons after it leaves.  The three other variables mono looks for to even
+try to set focus are shown in the label on the right.  Their state is fine,
+the only thing preventing it is the is_focusing variable.
+Expected Results:
+Focus returns to the button whenver the mouse enters the control.
+How often does this happen? 
+Additional Information:
+Runs fine on Windows .NET

More information about the mono-bugs mailing list