LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
local sStartH
on mouseDown
put the mouseH into sStartH
end mouseDown
on mouseUp
put abs(the mouseH - sStartH) into t_diff
if abs(the mouseH - sStartH) > 50 then
if the mouseH < sStartH then
answer "go right"
else
answer "go left"
end if
else
pass mouseUp
end if
end mouseUp
The tests "go right" "go left" work fine, but if I tap on one of the underlying buttons, nothing happens. I thought the "pass mouseUp" statement would cause the mouseUp message to be passed to the next level.
Hi Paul,
Check out this: http://lessons.runrev.com/s/lessons/m/4 ... r-the-ipad
It uses touchStart, touchMove for swipes, it's down the page a bit. It also has buttons on it so it's much like yours. I see that you'll have to code "moveBack".
Aside from that the "pass mouseUp" is stopped in it's path after it was acted upon: http://lessons.runrev.com/s/lessons/m/4 ... ssage-path
You could use "send" based on the "mouseLoc" to the button in your code, but that seems very convoluted.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
I'm assuming that this is for mobile ?... attached a stack that allows you to 'swipe'...you would also be able to place buttons on the card that would accomplish the same thing... the 'swipe' only occurs if the 'swipe' covers a distance of 100 pixels... this can be changed to suit your needs...
Simon wrote:Hi Paul,
Check out this: http://lessons.runrev.com/s/lessons/m/4 ... r-the-ipad
It uses touchStart, touchMove for swipes, it's down the page a bit. It also has buttons on it so it's much like yours. I see that you'll have to code "moveBack".
Thanks Simon, I'm looking at that now. I tried something similar, by placing the swipe detection code on the card, but that only works if the position of the swipe start is not one of the buttons on the card. I see this example puts the swipe detection into the stack script, but as coded, I can't do that because I have other cards in the stack where the swipe detection is not needed.
Simon wrote:Aside from that the "pass mouseUp" is stopped in it's path after it was acted upon: http://lessons.runrev.com/s/lessons/m/4 ... ssage-path
You could use "send" based on the "mouseLoc" to the button in your code, but that seems very convoluted.
Simon
Yeah, I looked at that example, and played around with adding buttons, but I get couldn't those buttons to "see" the mouseUp either. Your last suggestion might be the best solution, even tho convoluted.
Altho, I don't understand your statement: 'the "pass mouseUp" is stopped in it's path after it was acted upon'? By ignoring the swipe and passing the mouseUp, has it been acted upon. Confused.
By ignoring the swipe and passing the mouseUp, has it been acted upon
Sorry my error.
Looking at the message path image (in the above lesson) pass mouseUp goes from the control to the card not to a control next to your big button.
I can't do that because I have other cards in the stack where the swipe detection is not needed
Can't that be handled by:
if this cd is not in mySwipeCards then exit
something like that, where you put all the swipeable cd's into a var or the otherway around (whichever list is shorter)?
Really mouseLoc isn't the way to go, it was just in case there was something you were leaving out. There are plenty of examples of swipes and buttons.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Simply by checking touchStart/End rather than mouseDown/Up on the card, the problem went away. I didn't need to 'pass touchStart' etc. from the buttons. The card seems to "see" the touches, even if they are on a button.
Yes, the app is destined for iOS, so that change does not create a problem, but I was hoping to make it run on my Windoze box, just for testing. No big deal.
I was actually quite close. By putting 'pass mouseDown" (& mouseUp) onto the buttons, I was able to swipe on a button, and the button would ignore the swipe and pass the mouseDown/Up to the card. But it wouldn't work if the mouseDown/swipe started on one button and the mouseUp/swipe ended on another button. I can't think why, but the card didn't "see" the mouseUp.