User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 49
function OnSessionSwitch( session, previousSession )
{
var b = CETerm.Session( session ).Browser;
if (b.DocLoaded)
{
var x = (session == 1) ? 195 : 10;
var y = (session == 1) ? 10 : 100;
b.AddMetaItem( "Battery", "x=" + x );
b.AddMetaItem( "Battery", "y=" + y );
CETerm.PostIDA( "IDA_INFO_REFRESH", 0 );
}
}
4.10 THE ONSTYLUSDOWN EVENT
The OnStylusDown event is fired when the user taps a terminal emulation
screen with a stylus or finger. This event is only fired if the tap does not activate
a standard “touch” feature. All touch features can be disabled in the CETerm
configuration. This handler can be used to activate user-defined hot-spots.
Syntax
function OnStylusDown( session, row, column )
session – index of currently active session
row – row of screen tap
column – column of screen tap.
Example
Several samples for OnStylusDown were given in Section 2.7. Following is an
example that starts a barcode scan if the row contains the word “scan”. Not all
hardware devices support a scan trigger by script. If tapping on an IBM screen,
you must tap on an input field in the row, or the focus will not be in an input field
when the scan is sent to the session. Of course the “OnBarcodeRead” handler
could be used to force the scanned data into a preferred input field.
/* OnStylusDown */
function OnStylusDown( session, row, column )
{
var screen = CETerm.Session( session ).Screen;
// Get row of text
var text = screen.GetTextLine( row );