Sleep Function

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

Re: Sleep Function

Post by rbytes » Fri Feb 01, 2019 7:53 pm

Your description of the Text Screen as being similar to a full-screen field got me curious. I had not made that connection before. The text screen does detect touch. You can display fields on it, and SB knows where you are touching, since it will put the cursor into the field you touch.

I started to wonder "What would happen if you touched outside any fields created on the text screen?"

The answer - the touch command works in those areas! My next step was to create a tiny field in the upper corner of the TEXT screen. Now I can tape anywhere on screen and read the coordinates. You can also detect touches of any number and use them to trigger actions.

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
Attachments
D9981C82-0B57-4560-BABC-ED7711B60417.png
D9981C82-0B57-4560-BABC-ED7711B60417.png (153.38 KiB) Viewed 104 times
Zzzzz

Post Reply