[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.7.6 Define/Detect Touchscreen Area (#T)

The Define/Detect Touchscreen Area command performs several functions, depending on the arguments it is passed. Cogsys uses the serial output of the ELO Touchsystems 1725C to detect where it is on a 640-pixel-wide by 480-pixel-high screen. Specifically-defined touch-sensitive areas are squares whose centers and side lengths are passed to #T.

There is no indication on the screen that the #T command has been invoked, much like the #R command. If you desire a place indicating where the user is to touch, use #G to put a letter/word there, or use #H to put a shape there, or use squarext.cxr, circext.cxr, etc, to put other shapes in the desired location.

The timing for the Define/Detect Touchscreen Area (#T) begins with the invoking of the command, and ends with the screen being touched, or the @-key is pressed.

`#T'
This is the simplest form - returns a z or / if the left side or right side of the screen is pressed
`#T[K,X,Y,S]'
Here, letter 'K' is defined to be centered at (X,Y), and has a side length 'S'
`#T[K]'
Here, letter 'K' was already defined, and #T will return only after the defined area for 'K' (or @) is pressed.

If two response areas overlap, then the key area whose center is closest to the touch is declared the 'response'.

If one or more areas have been defined, and the touch does not occur in any of the areas, then a 'y' is returned as the response key.

Name:
Timed Response Any Button
Class:
Touchscreen
Code:
#T
Syntax:
#T ; #T[K,X,Y,S] ; #T[K]
System:
Defines or waits for a screen touch. For the "wait until screen touch" functions, Cogsys variable 7 (COGVAR_KEY) is updated with the letter code for a defined area. Cogsys variable 5 (COGVAR_TIME) is updated with the reaction time.
Output:
For the "wait until screen touch" functions, writes the letter corresponding to the area pressed, or a 'y' if outside any pre-defined areas.

Breakout:
YES

Test Files:
TOUCHT_T01.IN: Tests basic operation

 
%M2
@C
%A[X320,Y100,J2,F1]
#G[Testing touchscreen press]#W500

%A[Y150]#G[Touch the left-half of the screen]
#T@C
%A[Y100]#G[You pressed a]%A[Y150]$SV7
%A[Y200]#G[after]%A[Y250]$SV5
%A[Y300]#G[milliseconds]
#W3000@C

%A[Y150]#G[Touch A B C or D]
#T[A,50,400,50]
%A[X50,Y400,J2,C15,F1]#G[A]
#T[B,250,400,50]
%A[X250]#G[B]
#T[C,390,400,50]
%A[X390]#G[C]
#T[D,590,400,50]
%A[X590]#G[D]
#T@C
%A[X320,Y100]#G[You pressed a]
%A[Y150]$SV7%A[Y200]#G[after]%A[Y250]$SV5
%A[Y300]#G[milliseconds]
#W3000@C

%A[Y150]#G[Touch the square on the left or right]
#T[z,250,200,50]#T[/,390,200,50]
%A[X250,Y200,J2,S50,C15,F1]#H[]%A[X390]#H[]
#T@C
%A[X320,Y100]#G[You pressed a]%A[Y150]$SV7
%A[Y200]#G[after]%A[Y250]$SV5
%A[Y300]#G[milliseconds]
#W3000@C

%A[Y150]#G[Touch anywhere on the screen]
%A[Y200]#G[except for the square on the right,]
%A[Y250]#G[then touch the square on the right]
#T[z,250,400,50]#T[/,390,400,50]
%A[X250,Y400,J2,S50,C15,F1]#H[]%A[X390]#H[]
#T[/]@C
%A[X320,Y100]#G[You pressed a]%A[Y150]$SV7
%A[Y200]#G[after]%A[Y250]$SV5
%A[Y300]#G[milliseconds]
#W3000@C

@C%A[Y200]#G[Done.  Touch the screen to exit.]#T

Examples:

input
#T
subject
Touches the right-side of the screen after 500 millisconds
output
/500

input
#T[d,100,100,60]
subject
Screen area for 'd' defined. Nothing for the subject to do.
output
Nothing

input
#T[d]
subject
Touches the area defined to belong to 'd' after 750 milliseconds
output
d750


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November, 24 2008 using texi2html