Download iBrowse User's Guide

Transcript
Appendix B
— iBrowse Custom Edit Control
KeyPress
The OnKeyPress event is fired when a key on the physical or
onscreen keyboard is pressed and the ITCAXEdit control has
focus. To leave the key value as-is, set the return value to 0, .To
cancel the key press or have another key value to replace the value passed, set the value to –1.
Syntax
int OnKeyPress(int key)
Parameter
Description
key
An Integer value that holds the ASCII code of the key pressed.
Example
Create two edit controls and trap the tab key so it sets focus to the next edit control.
<HTML>
<HEAD></HEAD>
<BODY>
EditBox1 <OBJECT ID=”IBEAX1”
CLASSID=”CLSID:D8A6AACE-0F02-4440-8F07-64CF68F33DE9” WIDTH=”50”
HEIGHT=”25”>
EditBox2 <OBJECT ID=”IBEAX2”
CLASSID=”CLSID:D8A6AACE-0F02-4440-8F07-64CF68F33DE9” WIDTH=”50”
HEIGHT=”25”>
</BODY>
<SCRIPT LANGUAGE=”JSCRIPT” FOR=”IBEAX1” EVENT=”OnKeyPress()”>
if (key == 9)
{
IBEAX2.SetFocus(1);
// set focus to the second control
Return -1;
// no need to pass the key back to
the control
}
return 0;
// pass the key value along a
</SCRIPT>
<SCRIPT LANGUAGE=”JSCRIPT” FOR=”IBEAX2” EVENT=”OnKeyPress()”>
if (key == 9)
{
IBEAX1.SetFocus(1);
// set focus to the first control
Return -1;
// no need to pass the key back to
the control
}
return 0;
// pass the key value along a
</SCRIPT>
</HTML>
94
iBrowse User’s Guide