Page 1 of 1

How to make an animated wait icon

Posted: Sun Apr 24, 2016 1:25 pm
by mrcoollion
Anybody have a suggestion on how to make a animated wait icon?

I have tried to use an animated gif but as soon as livecode is busy with a database command or shell command everything else halts including the animated gif.
I have tried to use a 'sub'stack but I get the same result. Also shifting the focus from main to sub stack and back i do with open stack but i guess this is not the best solution?

Regards,

Paul

Re: How to make an animated wait icon

Posted: Thu Dec 15, 2016 7:49 pm
by JonathanLynch
Hi Paul,

To do this, you need to present the wait icon as an animated gif, through a browser widget. I just uploaded a sample stack through the Sample Stacks menu option in the IDE. Just search for Nonblocking Spinning Wait Demo.

The keys to making it work are these:

1. Put the data for the gif animation into a dataurl, as part of the htmltext of the browser widget. Basically, you put the image (not the imagedata) into a variable, then base64 encode it. Then you stick that into a properly formatted dataurl in the htmltext of the browser widget. The htmltext of the browser widget in the sample stack shows how this is done.

2. Move the widget off-screen before setting it visible or invisible, to eliminate glitches when you call it up.

3. The browser widget will occupy a square space, so put it over an object that helps it blend in, if you don't want the square space to be obvious. In the sample stack it is placed over a circle graphic.

Edit: I just changed the stack I uploaded. Now it is called Nonblocking Spinning Wait Creator. You can use it to directly create the desired widget with whatever gif animation you like. The stack tells you how to use the browser widget for displaying a wait indicator.

Re: How to make an animated wait icon

Posted: Sat Dec 17, 2016 4:08 pm
by mrcoollion
Thanks Jonathan :D