How to make an animated wait icon

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

How to make an animated wait icon

Post by mrcoollion » Sun Apr 24, 2016 1:25 pm

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

JonathanLynch
Posts: 22
Joined: Mon Apr 10, 2006 1:42 pm
Location: Atlanta
Contact:

Re: How to make an animated wait icon

Post by JonathanLynch » Thu Dec 15, 2016 7:49 pm

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.
The key to a happy life is to practice love for all things.

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: How to make an animated wait icon

Post by mrcoollion » Sat Dec 17, 2016 4:08 pm

Thanks Jonathan :D

Post Reply

Return to “Talking LiveCode”