Stop inputs while animating (mobile)

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Stop inputs while animating (mobile)

Post by JereMiami » Thu Mar 25, 2021 6:53 pm

How do you stop Livecode from accepting input (such as mouseDown or dragging) while something is animating?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Stop inputs while animating (mobile)

Post by richmond62 » Thu Mar 25, 2021 6:55 pm

This should be a general question not just confined to
mobile platforms.

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Stop inputs while animating (mobile)

Post by liveme » Thu Mar 25, 2021 7:03 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Stop inputs while animating (mobile)

Post by richmond62 » Thu Mar 25, 2021 7:04 pm

Um, but using lockscreen will mean that the animation is hidden . . .

JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Re: Stop inputs while animating (mobile)

Post by JereMiami » Thu Mar 25, 2021 7:08 pm

Lockscreen is dead in the water. Skips the animation, unfortunately.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stop inputs while animating (mobile)

Post by Klaus » Thu Mar 25, 2021 7:17 pm

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.

JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Re: Stop inputs while animating (mobile)

Post by JereMiami » Thu Mar 25, 2021 8:12 pm

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stop inputs while animating (mobile)

Post by Klaus » Thu Mar 25, 2021 8:28 pm

...or that way! :-)

JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Re: Stop inputs while animating (mobile)

Post by JereMiami » Fri Mar 26, 2021 1:19 pm

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

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

Re: Stop inputs while animating (mobile)

Post by andresdt » Fri Mar 26, 2021 7:59 pm

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”