<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>How do I set up a keypress interaction in Xerte?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Verdana">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 SIZE=2 FACE="Verdana">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 SIZE=2 FACE="Verdana">keyPressed = Key.getCode();</FONT>
</P>

<P><FONT SIZE=2 FACE="Verdana">if ((keyPressed == 13) || (keyPressed == 9)) { // Enter or Tab pressed</FONT>

<BR><FONT SIZE=2 FACE="Verdana">&nbsp;&nbsp;&nbsp; rootIcon.nextPage();</FONT>

<BR><FONT SIZE=2 FACE="Verdana">}</FONT>
</P>

<P><FONT SIZE=2 FACE="Verdana">Of course, nothing happens when I press Enter or Tab. What would be the correct way to do this?</FONT>
</P>

<P><FONT COLOR="#808080" SIZE=2 FACE="Courier New">_____________________________</FONT>
</P>

<P><FONT COLOR="#808080" SIZE=2 FACE="Courier New">&nbsp;Paul Swanson</FONT>

<BR><FONT COLOR="#808080" SIZE=2 FACE="Courier New">&nbsp;Instructional Designer</FONT>

<BR><FONT COLOR="#808080" SIZE=2 FACE="Courier New">&nbsp;Harland Financial Solutions</FONT>

<BR><FONT COLOR="#808080" SIZE=2 FACE="Courier New">_____________________________</FONT>
</P>

</BODY>
</HTML>