About   -   Contact   -   Purchase   -   Search   -   What's New

Flicker Free Animation
If you have ever tried to create an animated picture control in PowerBuilder then you will probably have run into problems with the control flickering when the control gets updated.

This flickering is caused by windows updating the control ready for use/display. Well with a slightly different approach and a neat trick we can eliminate the flicker.

Instead of placing a picture control in the place you want it to appear in your window. Expand the window and place the control out of the users visual portion of the display or you can also make the control invisible.

Set up your animation script as normal but inside your animation function or processing loop add the following command.

p_1.Draw( x, y )

This takes a copy of the current picture in your control and stamps it into the client area of the window. The image is not a control and will destroy anything in that location. Then swap your picture control to the next image. When the picture control updates the user does not see any flicker as it is not in the visible portion of the window or is invisible. Then the next time around you just stamp another image in the same location!

In use I have developed this into a set of custom user object controls. That way the user cannot resize the window and see the hidden control. I have a few controls which come complete with a series of smoothly animated bitmaps. When I need an animation I just place the user object in the window and hookup the window script to the animation function in the object.


Top of Page

Legal Notice

Ken Howe 2011