trichview.com

trichview.support




Re: Sizing and Clicking of Animated Gif's


Return to index


Author

Message

Sergey Tkachenko

Posted: 06/25/2003 12:22:07


I assume that you inserted gifs in TImage (this is the only way to show

animated gifs).

If you intserted gifs in TGifImage, they must be resizable just like

bitmaps.


While images are resizable by default, you need to make special actions to

make controls resizable


1) Set option allowing resizing the given control

2) Process control's OnClick: it should select this control in document

(it's not necessary, but it allows to show resizing handles when clicking

this control)


Example (assuming that control is added when document is generated):


...

ctrl.OnClick := OnControlClick;

rve.AddControlEx('', ctrl, ...);

rve.SetItemExtraIntProperty(rve.ItemCount-1, rvepResizable, 1);

...


procedure TForm1.OnControlClick(Sender: TObject);

begin

  rve.SelectControl(TControl(Sender));

end;


Events are not saved in RVF. So you need to process rve.OnControlAction and

reassing this event when control is loaded from RVF:


// assuming that gif is in TImage

procedure TForm1.rveControlAction(Sender: TCustomRichView;

  ControlAction: TRVControlAction; ItemNo: Integer; var ctrl: TControl);

begin

  if (ControlAction=rvcaAfterRVFLoad) and (ctrl is TImage) then

      TImage(ctrl).OnClick := OnControlClick;

end;


That's all.


If the control should be inserted at the position of caret, use the code:


ctrl.OnClick := OnControlClick;

rve.BeginUndoGroup(rvutInsert);

rve.SetUndoGroupMode(True);

rve.InsertControl('', ctrl, ...);

if rve.CurItemStyle=rvsComponent then

    rve.SetCurrentItemExtraIntProperty(rvepResizable, 1, True);

rve.SetUndoGroupMode(False);


Control resizing is implemented in Demos\



> Hi all,

>

> I inserted a gif and it works, but how can I resize or select it by

clicking

> on it. "The same way as with a normal image (bitmap)"

>

> Regards,

>

> Peet

>

>







Powered by ABC Amber Outlook Express Converter