Touch Events in iOS Browser

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jstarkman
Posts: 47
Joined: Wed Mar 16, 2011 4:39 am

Touch Events in iOS Browser

Post by jstarkman » Tue Apr 05, 2011 12:48 pm

Hi.

Hopefully someone can help me with a problem I'm having. I have started to create an iPad app to display a local PDF file. I can't seem to trap touch events on the browser object. I have the following script at the card level and have a label to display the points so I can try to figure out what's happening. In the iOS Simulator, labelTouchPoint tracks mouse events, but when I try the same thing on the PDF file image (in the browser object), I get nothing. The PDF file pans, scrolls and scales properly using the mouse & option key, but I'm trying to trap a simple mouseDown or touchStart event and can't seem to do that. What am I doing wrong?


global sBrowserId

on touchStart pTouchId, pX, pY    # Sent each time a new touch is startedend touchStart
global sBrowserId
put (pX & comma & pY) into field "labelTouchPoint"
end touchStart

on touchEnd pTouchId, pX, pY   # Sent each time a touch endsend touchEnd
global sBrowserId
put (pX & comma & pY) into field "labelTouchPoint"
// cmdShowMainTools
end touchEnd

on touchMove pTouchId, pX, pY    # Sent when any touch moves    set the loc of the target to pX,pYend touchMove
global sBrowserId
put (pX & comma & pY) into field "labelTouchPoint"
end touchMove


Thanks,

Joel

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Touch Events in iOS Browser

Post by JosepM » Wed Apr 06, 2011 1:22 am

Hi,

Check this post.

http://forums.runrev.com/phpBB2/viewtop ... 159#p32723

Salut,
Josep M

jstarkman
Posts: 47
Joined: Wed Mar 16, 2011 4:39 am

Re: Touch Events in iOS Browser

Post by jstarkman » Thu Apr 07, 2011 12:18 am

Thanks Josep.

I've reviewed the post you recommended, but don't quite understand the code/logic. Do you have a working code snippet you could share? I think if I see a working version of the function it might make more sense. The document in my browser group isn't an HTML page, but a PDF.

Thanks in advance,
Joel

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Touch Events in iOS Browser

Post by JosepM » Thu Apr 07, 2011 7:44 pm

Hi Joel,

Maybe with a PDF the thing isn't easy, what you want trap when the user touch the PDF?

Turn the page? Then you can evaluate in what zone of the pdf the touch is done, and then go to the next page or the previous.
If the PDF have links, they should work...

Salut,
Josep

jstarkman
Posts: 47
Joined: Wed Mar 16, 2011 4:39 am

Re: Touch Events in iOS Browser

Post by jstarkman » Thu Apr 07, 2011 8:21 pm

Josep,

Mainly, I want to do a couple things with the PDF:

1) I want to be able to determine when a touchEnd (or mouseUp) event happens, anywhere on the browser object, so I can display a menu.
2) I want to be able to determine the location of the touchEnd (or mouseUp) event on the PDF.

If I can accomplish the first, the second will be possible as well along with some additional code. I can't even do the first one yet.

Joel

Post Reply