« [Commentary] I'm a PC, I'm a Mac...Servoy style | Main | [Article] UI tricks: move, resize, hide, and show interface elements »
June 26, 2006
[Tip] Showing status with an animated gif
by David Workman
Data Mosaic
Some operations take a while to complete -- looping through a set of records, retrieving records using a custom query, querying a web service, etc. An often used way to denote progress in these operations is to use the progress bar bean. This method works quite well when you are in a looping method but the downsides are that it requires a screen redraw to update -- application.updateUI() -- which can really slow things down. Also, what do you do for those instances where it takes a few seconds (or longer) for just one line of code to complete?
One option is to use Marcel's dialog plugin which has a function that shows the default Mac "spinner" which is a neat effect.
Another is to use an animated gif. Animated gifs are treated just like regular graphics in the Servoy image library and can be assigned to objects on your forms the same way. Which includes assigning them dynamically within a method. Example:
elements.status.setImageURL("media:///status_animation.gif")
So it is simply a matter of assigning an element on your form to an animated gif at the beginning of a process that you know will take some time to complete and then setting it back to the original graphic (or null) when the line of code is done.
Voila!
| Posted by David Workman on June 26, 2006 at 11:46 PM in Tips | Permalink
Comments
Nice tip!
Additionally one can add an animated gif to a splash screen in the Splash plugin.
In ALL cases, progressbar, animated gif etc. it is important to take into account that it is not necessarily so that anything will happen on the screen. When a task is very time consuming we will see no progress. Unfortunately...
Cheers,
Marcel
Posted by: Marcel Trapman | Jun 27, 2006 7:40:12 AM
Great post. Sometimes it is useful just to let the user know that Servoy is doing something...but you may not need to show the exact progress. FYI, I found a good looking mac progress bar at http://img471.imageshack.us/img471/3043/downloadani1gx.gif
Posted by: Scott Butler | Jun 28, 2006 11:00:00 AM
That one is definitely worth snagging. Thanks.
Posted by: David Workman | Jun 29, 2006 11:08:05 AM
Yes, but you can now have a real, millisecond-precision, interruprible progress dialog that executes within the context of your servoy method.
See:
http://forum.servoy.com/viewtopic.php?t=6787
Posted by: cybersack | Sep 1, 2006 5:40:19 PM