home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 March
/
Chip_1999-03_cd.bin
/
zkuste
/
delphi
/
INFO
/
DI9806CJ.ZIP
/
ANIMATEU.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-03-22
|
2KB
|
86 lines
unit animateu;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls, TypInfo;
type
TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
Label1: TLabel;
Panel1: TPanel;
Animate1: TAnimate;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Animate1.Stop;
Button1.Caption := '&Start';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if ComboBox1.Text = 'aviNone' then exit;
if Button1.Caption = '&Start' then
begin
Animate1.Play(1,Animate1.FrameCount,0);
Button1.Caption := '&Stop';
end
else
begin
Animate1.Stop;
Button1.Caption := '&Start';
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
ca: TCommonAvi;
begin
//for each of the values of the TCommonAVI enumerated type
for ca := low(TCommonAvi) to high(TCommonAvi) do
begin
//Get the string equivalent of the enumerated type value
ComboBox1.Items.Add(GetEnumName(TypeInfo(TCommonAvi),Ord(ca)));
end;
ComboBox1.ItemIndex := 0;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
var
ValueOrd: Integer;
begin
if Animate1.Active then
begin
Button1.Caption := '&Start';
Animate1.Stop;
end;
//Get the ordinal position of the value associated
//with the selected string in the ComboBox.
ValueOrd := GetEnumValue(TypeInfo(TCommonAvi),
ComboBox1.Items[ComboBox1.ItemIndex]);
//Cast this ordinal value to the TCommonAVI type
Animate1.CommonAVI := TCommonAVI(ValueOrd);
end;
end.