Stop all interactions or return to fisrt state onclick

newbie-question

#1

Hi, is it posible to stop all interactions that are runing of all the elements in the screen by, making click in a button? Or return the elements to they first state?

thanks


#2

Depends what you mean by “stop interactions” …If you want to block most user interaction (clicks, drags, etc.) probably the easiest thing to do would be to have a hotspot hidden, or placed behind everything, then when needed, set its size to
( [[Window.width]] , [[Window.height]] )
and Show, bring to front.
It won’t prevent user from scrolling the page, navigating away, etc.

If you want to stop ongoing animations, transitions or processes, that won’t be as easy, and in some cases basically impossible. For example, if you have an action like, “Move MyWidget by (500, 500), linear 10000 ms” that is a ballistic action which cannot be stopped once started. MyWidget will move 500 px to right and 500 px down over the course of 10 seconds no matter what (as long as the page is active.) There is no way to break into that process. But, you could create a kind of “recursive function” with “Move MyWidget by (5, 5), linear 100ms” and repetitively calling it 100 times. Then a conditional case can test a value to see if it should stop running.

Depends what you mean by “first state” …If it is an actual state in a dynamic panel, you can use an action of, “Set State of MyDP to (state #) 1”. If it is something else, like resetting the initial text value, selection state, location, size, etc. you could build in a kind of “hidden reset function” in each widget by making use of an otherwise unused event, like Rotated which sets all changed properties to their initial defaults. For example,

Rotated
Set Text of This to “default text string”
Set Selected of This to false
Set Size of This to 50w x 30h
Move This to (10, 45)
etc…

Then, to reset that widget, just rotate it by (0, 0) or call Fire Event Rotated of MyWidget”.

Or, you can just call Open Link and select the “reload page” option. Might sound glib, but it is the easiest and most reliable way to do what you’re asking.