How to Display an Animated GIF File in an ATEasy Form

Knowledge Base Article # Q200225

Read Prior Article Read Next Article
Summary How to display an animated GIF file on a form
In ATEasy form's, animated GIF files are supported by the ALog control. To display an animated GIF in a log control, set the control to HTML mode (PlainText property set to False), and then append an image tag with the GIF file.
The image file is defined using the HTML IMG tag and can then be inserted into the ALog control using the Append method.

The height and width of the image can be specified using the height and width attributes.
For example, the following line links the image to the "C:\geotest.gif" file and sets the image height and width to 42.

  <img src="c:\\geotest.gif" height="42" width="42" />

The image is then appended to the ALog control using the Append control as follows:

  log1.Append("<img src=\"c:\\geotest.gif\" height=\"42\" width=\"42\" />")

To hide the ALog's scrollbar, which is displayed by default, insert the following into ALog's OnLoad event:

  log1.Document.body.setAttribute("scroll", "no")

The image can be positioned in the ALog control by setting the ALog control margins. For example, inserting the following settings into AForm's OnLoad event will align the image in the Top-Left corner of ALog control :


Here is the complete code for displaying the animated GIF in a log control:

  ! set the ALog Window to HTML mode to display the animated image file
  ! remove the Scroll bar
  logAnimated.Document.body.setAttribute("scroll", "no")
  ! position the image in the Top-Left corner of the ALog control
  ! get the dimensions of the ALog control for the image height and width settings
  ! place the image in the ALog window
  sText="<IMG SRC=\"File:"+GetDir(aGetDirAppExe)+"\\Hourglass_icon.gif"+        " \"width=\""+str(fWidth)+" \"height=\""+str(fHeight)+"\">"

An ATEasy application that demonstrates how to load an animated GIF file into a form can be downloaded by clicking on this link The application opens a window that displays a spinning hourglass. The main section of code can be found in the OnLoad event for the program form.
Article Date 2/27/2012 2:37:18 PM     Updated: 4/16/2014 4:03:58 PM
Keywords gif, animatation, ATEasy, form, ALog

0 ratings | 0 out of 5
Read Prior Article Read Next Article