Page 1 of 1

After copy/paste gif animations don't play

Posted: Mon Jun 16, 2008 8:58 am
by dream_adv
Give the advice.
How start play animation when item copy and paste to same richviewedit control ?
TRichview v10.1

Posted: Mon Jun 16, 2008 10:16 am
by Sergey Tkachenko
See here: http://www.trichview.com/forums/viewtopic.php?t=89 (the 2nd and 3rd posts)

Posted: Mon Jun 16, 2008 10:28 am
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)

Posted: Mon Jun 16, 2008 10:56 am
by Sergey Tkachenko
In addition to using this TGifImage, you must also set RichViewEdit.AnimationMode = rvaniOnFormat, and include RVGifAnimate.pas in your project.

Posted: Mon Jun 16, 2008 12:29 pm
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.

Posted: Tue Jun 17, 2008 4:04 am
by dream_adv
up.
So how right to do that? I'm need to work copy/paste of animated gif's in editor.

Posted: Tue Jun 17, 2008 4:57 am
by Sergey Tkachenko
Please send me example reproducing the problem

Posted: Tue Jun 17, 2008 10:49 am
by dream_adv
I sent source example with binary exe to <[email protected]>

Posted: Tue Jun 17, 2008 11:23 am
by Sergey Tkachenko
Exe file will be rejected by the mail server (even in zip)

Posted: Tue Jun 17, 2008 12:25 pm
by dream_adv
ok sent again with url link.

Posted: Tue Jun 17, 2008 2:41 pm
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)

Posted: Wed Jun 18, 2008 3:51 am
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 ?

Posted: Wed Jun 18, 2008 4:44 am
by Sergey Tkachenko
You still need to register it RegisterClass(TGifImage)

Posted: Wed Jun 18, 2008 6:06 am
by dream_adv
Sergey Tkachenko wrote:You still need to register it RegisterClass(TGifImage)
Thank you very much now all work fine... :)