<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>How do I set up a keypress interaction in Xerte?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=314005607-23072008><FONT face=Arial
color=#0000ff size=2>If you tab to the button, you can then press 'space' to
activate it. This is accessibility good practice, in line with the guidelines
for allowing keyboard or mouse control.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=314005607-23072008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=314005607-23072008><FONT face=Arial
color=#0000ff size=2>To do as you describe, use rootIcon as the broadcasting
icon, then you code below works. I think the problem was registering and
de-registering key listeners for individual icons. You only really need one icon
to notify you of onKeyDown, and rootIcon made the most sense, so I hooked it up
to that,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=314005607-23072008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=314005607-23072008><FONT face=Arial
color=#0000ff size=2>J</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk
[mailto:xerte-bounces@lists.nottingham.ac.uk] <B>On Behalf Of </B>Paul
Swanson<BR><B>Sent:</B> 22 July 2008 23:13<BR><B>To:</B> Xerte discussion
list<BR><B>Subject:</B> [Xerte] How do I set up a keypress interaction in
Xerte?<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<P><FONT face=Verdana size=2>I'm trying to set up a keypress interaction, so a
user can press Enter or Tab instead of clicking a button.</FONT> </P>
<P><FONT face=Verdana size=2>I have an Interaction icon with a Button response
working fine, and to that same interaction I added an Event response. For the
eventName I used onKeyDown(), for the icon property I used the id of the
Interaction icon. To the Event response icon I added a script icon with the
following:</FONT></P>
<P><FONT face=Verdana size=2>keyPressed = Key.getCode();</FONT> </P>
<P><FONT face=Verdana size=2>if ((keyPressed == 13) || (keyPressed == 9)) { //
Enter or Tab pressed</FONT> <BR><FONT face=Verdana size=2>
rootIcon.nextPage();</FONT> <BR><FONT face=Verdana size=2>}</FONT> </P>
<P><FONT face=Verdana size=2>Of course, nothing happens when I press Enter or
Tab. What would be the correct way to do this?</FONT> </P>
<P><FONT face="Courier New" color=#808080
size=2>_____________________________</FONT> </P>
<P><FONT face="Courier New" color=#808080 size=2> Paul Swanson</FONT>
<BR><FONT face="Courier New" color=#808080 size=2> Instructional
Designer</FONT> <BR><FONT face="Courier New" color=#808080 size=2> Harland
Financial Solutions</FONT> <BR><FONT face="Courier New" color=#808080
size=2>_____________________________</FONT> </P></BODY></HTML>