Page 1 of 1

Detect Screen Touch in Text Mode

Posted: Fri Feb 01, 2019 9:54 pm
by rbytes
I posted a similar comment in Other Topics to be sure Mr. K and Dutchman were aware of it. The documentation for TOUCH commands says that they don't work in text mode. But they do under special conditions, opening up new possibilities for user control on a TEXT screen.

The trick is to create a field on the TEXT screen. It can be as tiny as 1 x 1 points and located at a screen corner. That activates the whole screen for detecting touches! In fact I just tested again with the field entirely outside the visible screen area (ie. made the field x coordinate a negative number.) The TOUCH commands still work.

Here is some code to demonstrate:

Code: Select all

/*
Touch in Text Mode
rbytes, February 2019
*/
FIELD "activate" TEXT "" AT 0,0 SIZE 1,1
PRINT "Touch with one finger to get screen coordinates in TEXT mode."
PRINT "Touch with two fingers to quit."
PRINT
DO SLOWDOWN
GET TOUCH 0 as x,y
GET TOUCH 1 as ox,oy
if x>-1 or y>-1 then print x,y
if ox>-1 then end
UNTIL 0

Re: Detect Screen Touch in Text Mode

Posted: Sat Feb 02, 2019 3:31 pm
by Dutchman
I have added a note on page 18 in the updated manual.
See viewtopic.php?f=79&p=13920#p13920