summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-07-18 12:53:26 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-07-18 12:53:26 -0400
commit016ab508175a1495e1e1e967467d481ac0258d5d (patch)
tree6b55accc9b388b5a6a51795811f7660a5ff5c682 /lib
parenta38526edd81a66ad3f34cf65a66f4ba866dd1490 (diff)
Key events get key code input
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js7
-rw-r--r--lib/ur/basis.urs5
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 29728a7a..3d4dbea2 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -648,5 +648,12 @@ function rv(chn, parse, k) {
}
+// Key events
+
+function kc(e) {
+ return window.event ? e.keyCode : e.which;
+}
+
+
// App-specific code
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 5f13f5c9..7f06a47a 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -555,8 +555,9 @@ con mouseEvents = [Onclick = transaction unit, Ondblclick = transaction unit,
Onmousedown = transaction unit, Onmousemove = transaction unit,
Onmouseout = transaction unit, Onmouseover = transaction unit,
Onmouseup = transaction unit]
-con keyEvents = [Onkeydown = transaction unit, Onkeypress = transaction unit,
- Onkeyup = transaction unit]
+con keyEvents = [Onkeydown = int -> transaction unit, Onkeypress = int -> transaction unit,
+ Onkeyup = int -> transaction unit]
+(* Key arguments are character codes. *)
con resizeEvents = [Onresize = transaction unit]
con boxEvents = focusEvents ++ mouseEvents ++ keyEvents ++ resizeEvents