After copy/paste gif animations don't play

General TRichView support forum. Please post your questions here
Post Reply
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

After copy/paste gif animations don't play

Post by dream_adv »

Give the advice.
How start play animation when item copy and paste to same richviewedit control ?
TRichview v10.1
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

See here: http://www.trichview.com/forums/viewtopic.php?t=89 (the 2nd and 3rd posts)
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

Sorry, but you don't understand. The animation work normaly if i use InsertPicture method.
But if i select some gif image (from already added and play annimation normaly) and copy/paste it in same TRichViewEdit control. I will have only still frame with new pasted images. (with some pallete bug, black color will be transparent)

I use this gif companent: http://www.trichview.com/resources/thir ... fimage.zip (update - required)
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In addition to using this TGifImage, you must also set RichViewEdit.AnimationMode = rvaniOnFormat, and include RVGifAnimate.pas in your project.
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

I have all this and animation play.

Updated:
After i try to prepare sample for you.
This problem exist when in project exist unit from rxlib GIFCtrl.
But if it don't exist the copy/paste of gif animated images don't work.
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

up.
So how right to do that? I'm need to work copy/paste of animated gif's in editor.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please send me example reproducing the problem
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

I sent source example with binary exe to <svt@trichview.com>
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Exe file will be rejected by the mail server (even in zip)
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

ok sent again with url link.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This problem happens because you have two TGifImage classes - from RxGif.pas and from GifImage.pas.
When you insert TGifImage, you insert GifImage.TGifImage, because GifImage is included in "uses" of your unit. But when pasting, RxGif.TGifImage is inserted (because it is registered with RegisterClasses procedure). Animation of this class is not supported by TRichView.

Solutions:
1) Add RxGif in "uses" (before GifImage, otherwise TGifImage will be treated as RxGif.TGifImage, not as GifImage.TGifImage) and call in FormCreate:

Code: Select all

  UnRegisterClass(RXGif.TGIFImage);
  RegisterClass(GifImage.TGifImage);
or, better

2) Do not use Gif image from RX. Why do you need duplicate classes? GifImage.TGifImage can play animations directly in TImage (or you can use TRichView with one image instead of TImage)
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

Sergey Tkachenko wrote: or, better
2) Do not use Gif image from RX. Why do you need duplicate classes? GifImage.TGifImage can play animations directly in TImage (or you can use TRichView with one image instead of TImage)
Thank you. I try to remove RX gif. But when i do it copy/paste do nothing after copy gif nothing wants to paste.

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CRVData, CRVFData, RVScroll, RichView, RVEdit, GifImage, RVGifAnimate,
  RVStyle, Animate;

type
  TForm1 = class(TForm)
    RVStyle1: TRVStyle;
    Button1: TButton;
    SendRVEdit: TRichViewEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  smgif: TGifImage;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  smgif := TGifImage.Create;
  smgif.LoadFromFile(ExtractFileDir(ParamStr(0))+'\bc.gif');
end;

procedure TForm1.Button1Click(Sender: TObject);
var gif: TGifImage;
Begin
  gif:=TGifImage.Create;
  gif.Assign(smgif);
  SendRVEdit.InsertPicture('',gif,rvvaBaseLine);
end;


end.
rvoAutoCopyRVF=True
rvoAutoCopyImage=True

What i miss or do wrong ?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You still need to register it RegisterClass(TGifImage)
dream_adv
Posts: 8
Joined: Tue May 27, 2008 7:45 am

Post by dream_adv »

Sergey Tkachenko wrote:You still need to register it RegisterClass(TGifImage)
Thank you very much now all work fine... :)
Post Reply