[Mono-bugs] [Bug 78481][Nor] Changed - Control OnLeave() is incorrectly invoked when it gets focus

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 23 00:57:18 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=78481

--- shadow/78481	2006-05-22 14:42:13.000000000 -0400
+++ shadow/78481.tmp.11395	2006-05-23 00:57:18.000000000 -0400
@@ -66,6 +66,38 @@
 Additional Information:
 
 If I understand correctly it kinda blocks bug #78363.
 
 ------- Additional Comments From atsushi at ximian.com  2006-05-22 14:42 -------
 Turned out that it also happens to other things like Form.
+
+------- Additional Comments From atsushi at ximian.com  2006-05-23 00:57 -------
+I dug it more in depth as well as I feel I need more explanation on it.
+
+* general Control event order
+
+see
+http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.lostfocus.aspx
+
+Two points could be read from above:
+
+- In Control, Leave is raised *after* LostFocus.
+- For Form, it should not raise Enter and Leave events as explained in
+the above page:
+
+"Typically, the GotFocus and LostFocus events are only used when
+updating UICues or when writing custom controls. Instead the Enter and
+Leave events should be used for all controls except the Form class,
+which uses the Activated and Deactivate events."
+
+(As far as I tried, Form also does not raise GotFocus and LostFocus.
+Attaching a modified test code. Moving focus to anywhere does not
+raise those events).
+
+* DataGrid events
+
+When its DataGridTextBox gets focus, WM_KILLFOCUS happens (at least on
+mono). In that case, DataGrid should not raise Leave event.
+
+On the other hand, it still raises LostFocus. Thus, Leave and
+LostFocus are not always parallel. Something similar might happen to
+other ContainerControls but I need more research on it.


More information about the mono-bugs mailing list