diff tests/mouseEvent.ur @ 1783:5bc4fbf9c0fe

New event records for key and mouse handlers
author Adam Chlipala <adam@chlipala.net>
date Sat, 21 Jul 2012 10:02:53 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/mouseEvent.ur	Sat Jul 21 10:02:53 2012 -0400
@@ -0,0 +1,16 @@
+val show_mouseButton = mkShow (fn b => case b of
+                                           Left => "Left"
+                                         | Middle => "Middle"
+                                         | Right => "Right")
+
+fun main () : transaction page = return <xml><body>
+  <button onclick={fn ev => alert ("ScreenX = " ^ show ev.ScreenX
+                                   ^ "\nScreenY = " ^ show ev.ScreenY
+                                   ^ "\nClientX = " ^ show ev.ClientX
+                                   ^ "\nClientY = " ^ show ev.ClientY
+                                   ^ "\nCtrlKey = " ^ show ev.CtrlKey
+                                   ^ "\nShiftKey = " ^ show ev.ShiftKey
+                                   ^ "\nAltKey = " ^ show ev.AltKey
+                                   ^ "\nMetaKey = " ^ show ev.MetaKey
+                                   ^ "\nButton = " ^ show ev.Button)}/>
+</body></xml>