[Mono-bugs] [Bug 77690][Wis] New - Control.OnClick do not supply a MouseEventArgs

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Mar 2 08:38:17 EST 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 sebastien at ximian.com.

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

--- shadow/77690	2006-03-02 08:38:17.000000000 -0500
+++ shadow/77690.tmp.28273	2006-03-02 08:38:17.000000000 -0500
@@ -0,0 +1,53 @@
+Bug#: 77690
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: sebastien at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Control.OnClick do not supply a MouseEventArgs
+
+Description of Problem:
+
+The method
+protected virtual void OnClick (EventArgs e);
+doesn't provide a MouseEventArgs when overridden. This makes it impossible
+to use it to get the mouse clicks.
+
+Steps to reproduce the problem:
+1. Compile this snippet inside a winform application
+
+protected override void OnClick (EventArgs e)
+{
+    MouseEventArgs mea = (e as MouseEventArgs);
+    if (mea == null)
+        Console.WriteLine ("Expected MouseEventArgs but got " + e.ToString ());
+}
+
+2. Click on the form
+
+
+Actual Results:
+EventArg is empty (not null) and cannot be cast to a MouseEventArgs (like
+on MS Fx). So the console shows
+Expected MouseEventArgs but got EventArgs
+
+Expected Results:
+I should be able to cast the EventArgs into a MouseEventArgs and get the
+click position (i.e. no message on console).
+
+How often does this happen? 
+Always
+
+Additional Information:
+* Only tested under fx 2.0 and Mono SVN.
+* Changed my code to overriding OnMouseDown (which use MouseEventArgs)


More information about the mono-bugs mailing list