Detect Screen Touch in Text Mode

Post Reply
User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Detect Screen Touch in Text Mode

Post 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
The only thing that gets me down is gravity...

User avatar
Dutchman
Posts: 851
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: Detect Screen Touch in Text Mode

Post by Dutchman »

I have added a note on page 18 in the updated manual.
See viewtopic.php?f=79&p=13920#p13920

Post Reply