7 custom screen hot-spots – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 21

Advertising
background image

N

AURTECH

W

EB

B

ROWSER AND

T

ERMINAL

E

MULATION FOR

W

INDOWS

CE

AND

W

INDOWS

M

OBILE




CETerm Scripting Guide

Page 21


2.7

C

USTOM

S

CREEN

H

OT

-S

POTS

A “hot-spot” is an area on a terminal emulation screen that is activated by taping
with your finger or the stylus. CETerm supports several pre-defined hot-spots for
TE sessions. With scripting, it is possible to define custom hot-spot behaviors.
Custom hot-

spots use the “OnStylusDown” event handler. Browser sessions do

not support the OnStylusDown event because equivalent behavior can be
implemented in HTML. You may need to disable the pre-defined hot-spots in
CETerm because they will be triggered before a custom hot-spot.

The hot-spot action can depend on the screen contents in an area or simply be
tied to a screen area. The following OnStylusDown handler can be loaded from
the script templates

/* OnStylusDown */
function OnStylusDown( session, row, column )
{
// Look for custom hot-spot
var screen = CETerm.Session( session ).Screen;
var text = screen.GetTextLine( row );
if (text.match( /beep/i ))
{
OS.PlaySound( "default.wav", 0 );
}
}


This hot-spot will play a sound if the

line touched contains the word “beep”. The

following hot-spots will activate VT function keys if the user touches in the
specified rows and columns. In this case, the screen can show a box drawn with
VT line drawing characters and text inside each box. With such a display, you
can effectively create large glove-friendly on-screen buttons in TE.

/* OnStylusDown */
function OnStylusDown( session, row, column )
{
// Buttons are on rows "start" through "end"
var buttonrowstart = 9;
var buttonrowend = 13;
var IDA = "IDA_NONE";

// Buttons are "buttonwidth" columns wide
// Leftmost button is #1
var buttonwidth = 5;
var button = Math.floor((column + buttonwidth - 1) /
buttonwidth);

if (row >= buttonrowstart && row <= buttonrowend)
{
switch (button) {

Advertising
This manual is related to the following products: