Page 1 of 1

Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 6:53 pm
by JereMiami
How do you stop Livecode from accepting input (such as mouseDown or dragging) while something is animating?

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 6:55 pm
by richmond62
This should be a general question not just confined to
mobile platforms.

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 7:03 pm
by liveme
Hi ..Miami ! 8)
https://livecode.fandom.com/wiki/Lock_screen
I'm using this, meanwhile LC processes a loop based on some input :
* I would beleive it stops user from changing an input value meanwhile the stack is processing the loop - but I'm no expert.

I've just reused this code from some other script.
..dont know if it can "freeze" a mouse behavior
only cats do indeed :mrgreen:

Terii

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 7:04 pm
by richmond62
Um, but using lockscreen will mean that the animation is hidden . . .

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 7:08 pm
by JereMiami
Lockscreen is dead in the water. Skips the animation, unfortunately.

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 7:17 pm
by Klaus
I ususally put an opaque graphic on top of my interface and an top of THAT I can animate,
let the user select something or anything where user interaction is not wanted.

Know what I mean?
The graphic just "eats" all mouse-events.

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 8:12 pm
by JereMiami
Thanks- Klaus you did inspire me to come up with the following solution. The problem is that when a grc is "not opaque" (i.e., transparent), it loses its ability to "eat" the mouseUp commands. So, keep it opaque and set its transparency to 100%. Put the grc over the animation and ... voila:

Code: Select all

on mouseUp
   enable grc "overlay" of cd "display"
   animateObject
   disable grc "overlay" of cd "display"
end mouseUp

Re: Stop inputs while animating (mobile)

Posted: Thu Mar 25, 2021 8:28 pm
by Klaus
...or that way! :-)

Re: Stop inputs while animating (mobile)

Posted: Fri Mar 26, 2021 1:19 pm
by JereMiami
Haha -yes

I would just add that you will need to add some delay to make sure the input is blocked on both ends. I ended up using this and it works 100% time.

Code: Select all

on mouseUp
   enable grc "overlay" of cd "display"
    wait .2 seconds
    animateObject
    wait .2 seconds
    disable grc "overlay" of cd "display"
end mouseUp

Re: Stop inputs while animating (mobile)

Posted: Fri Mar 26, 2021 7:59 pm
by andresdt
just like the screen crashes. You can also block the flow of messages.

Code: Select all

lock messages
unlock messages
and on mac and win you can use ignoreMouseEvents property