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 :
log1.Document.Body.LeftMargin=0
log1.Document.Body.TopMargin=0
Here is the complete code for displaying the animated GIF in a log control:
Sleep(1) !Wait for Form objects to complete loading
frmHGForm.Visible=True !Make the form visible
sImageDir=GetDir(aGetDirCurrent) !Get the current directory location
sImageName=sImageDir+"\\Logo.jpg" !Logo file name. Put the Logo on the top of the form
imgLogo.LoadFromFile(sImageName) !Load the logo
imgLogo.Visible=True !Make it visible
!Set the ALog Window to HTML mode to display the animated image file
logHGWid.PlainText=False
!Remove the Scroll bar
logHGWid.Document.body.setAttribute("scroll", "no")
!Position the image in the Top-Left corner of the ALog control
logHGWid.Document.Body.LeftMargin=0
logHGWid.Document.Body.TopMargin=0
!Clear the ALog window
logHGWid.Clear()
!Get the dimensions of the ALog control for the image height and width settings
fHeight=logHGWid.Height-4
fWidth=logHGWid.Width-4
!HTML Image string
sImageName="<IMG SRC=\"File:"+sImageDir+"\\Hourglass_icon.gif"+"\""+" width=\""+Str(fWidth)+"\" height=\""+Str(fHeight)+"\">"
!Place the image in the ALog window
logHGWid.Append(sImageName)
An ATEasy application that demonstrates how to load an animated GIF file into a form can be downloaded by clicking on this link Q200225 Example. 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.