TOUCH beginner

Post Reply
smabasgil
Posts: 46
Joined: Sat Dec 26, 2015 1:06 pm
My devices: Ipad 2
Flag: Bahamas

TOUCH beginner

Post by smabasgil »

About touches and GET TOUCH N AS X,Y command.
I make my first test and i am questioning...

It seems to me than once a "GET TOUCH 0" is issued, the only way to make this command to be executed again is to issue a "PAUSE n" before.

Is there some kind of reset to do before using "GET TOUCH 0" again ?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: TOUCH beginner

Post by Mr. Kibernetik »

I do not understand your problem with GET TOUCH AS command. What kind of reset do you need?
Next GET TOUCH AS command works immediately.

smabasgil
Posts: 46
Joined: Sat Dec 26, 2015 1:06 pm
My devices: Ipad 2
Flag: Bahamas

Re: TOUCH beginner

Post by smabasgil »

Thank you for taking care

In this code

--- --- ---

GRAPHICS
GRAPHICS CLEAR

FIELD "afcot1" TEXT "" AT 300,110 SIZE 300,25 RO
FIELD "afcot1" BACK ALPHA 0
FIELD "afcot2" TEXT "" AT 300,210 SIZE 300,25 RO
FIELD "afcot2" BACK ALPHA 0

WHILE (xt1=-1 AND yt1=-1) OR (xt1=0 AND yt1=0)
GET TOUCH 0 AS xt1,yt1
ENDWHILE

FIELD "afcot1" TEXT "xt1="&.xt1&" "&"yt1="&.yt1

WHILE (xt2=-1 AND yt2=-1) OR (xt2=0 AND yt2=0)
GET TOUCH 0 AS xt2,yt2
ENDWHILE

FIELD "afcot2" TEXT "xt2="&.xt2&" "&"yt2="&.yt2

--- --- ---

You can see that the 2 fields show the same content ( the coordinates of the first TOUCH ).

And as soon as you press one time the screen, the 2 fields are shown, it seems there no way to record a second press.

Now if you add "PAUSE .1" before :
WHILE (xt2=-1 AND yt2=-1) OR (xt2=0 AND yt2=0)

You got different coordinates in the 2nd field

That's what made me think that in the first case only one GET TOUCH can be 'seen' ou 'issued'

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: TOUCH beginner

Post by Mr. Kibernetik »

You need to have a loop to get multiple coordinates reading:

Loop:
Get touch 0 as x,y
...
Go to loop

smabasgil
Posts: 46
Joined: Sat Dec 26, 2015 1:06 pm
My devices: Ipad 2
Flag: Bahamas

Re: TOUCH beginner

Post by smabasgil »

Okay

Having a labelloop: is the only correct way to discriminate touches ?

I thought that inside my "WHILE", feeding different X and Y would force the command to be executed

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: TOUCH beginner

Post by Mr. Kibernetik »

Your WHILE loop waits for single touch and then exits. So how do you want to get next touch without main loop?

Post Reply