TAnimate
Fuente: source/classes/tanimate.prg
Inherits from: TControl
TAnimate wraps the Windows animation common control to display AVI (Audio Video Interleaved) clip files. It is typically used to provide visual feedback during longer operations such as file copying, searching, or printing. The control plays silent AVI clips in a fixed-size window and supports preset system animations.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
cAvi | Character | AVI file path or system animation resource name |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, oWnd, lPixel, lDesign, nW, nH ) | Create a new TAnimate control |
Open( cAvi ) | Open an AVI file or system animation for playback |
Play( nFrom, nTo, nRepeat ) | Play the animation from frame nFrom to nTo, repeating nRepeat times |
Stop() | Stop the current playback |
Close() | Close the AVI and release resources |
Seek( nFrame ) | Seek to a specific frame in the animation |
Preset System Animations
The following system AVI resource names can be passed to Open() for standard shell animations:
| Name | Description |
|---|---|
AVI_FINDFILE | Magnifying glass searching animation |
AVI_COPYFILE | Document being copied animation |
AVI_SEARCH | Search disk animation |
AVI_DELETE | Document being deleted (recycle) animation |
Example: File Copy Animation
#include "FiveWin.ch"
function Main()
local oWnd, oAnimate
DEFINE WINDOW oWnd TITLE "Copying Files..." SIZE 300, 150
@ 10, 10 ANIMATE oAnimate SIZE 280, 80 OF oWnd
oAnimate:Open( AVI_COPYFILE )
oAnimate:Play( 1, 100, 0 ) // 0 = repeat indefinitely
// Simulate a long operation
// ... file copy code here ...
oAnimate:Stop()
oAnimate:Close()
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- The AVI animation control plays silent video only; audio tracks are not supported by the underlying Windows common control.
- Pass
0as the repeat count to loop the animation indefinitely. UseStop()to end playback. - System animations (
AVI_FINDFILE,AVI_COPYFILE,AVI_SEARCH,AVI_DELETE) do not require an external AVI file; they are loaded from shell32.dll. - The control is hidden when no AVI is open. Call
Open()beforePlay()to load the clip. - TAnimate is ideal for modal dialog progress feedback where a progress bar would feel too technical.