Page 1 of 1

OnReadHyperlink for RVF

Posted: Mon Oct 11, 2010 9:32 am
by zet
Hello.

Is it possible to somehow call OnReadHyperlink while pasting RVF?
I need to convert links to my inner form when pasting.

Posted: Mon Oct 11, 2010 4:24 pm
by Sergey Tkachenko
Sorry, no. RVF is inserted as it is.

You can process OnPaste to paste in hidden RichViewEdit:

Code: Select all

var Stream: TMemoryStream;
begin
  if rveHidden.CanPasteRVF then begin
    rveHidden.PasteRVF;
    <process all items in rveHidden, change tags for links>
    Stream := TMemoryStream.Create;
    rveHidden.SaveRVFToStream(Stream, False);
    Stream.Position := 0;
    TCustomRichViewEdit(Sender).[color=red]InsertRVFFromStreamEd[/color](Stream);
    Stream.Free;
    DoDefault := False;
  end;
end;

Posted: Tue Oct 12, 2010 9:40 am
by zet
Well, there's no such thing as PasteRVFFromStream.
Did you mean InsertRVFFromStream?

Posted: Tue Oct 12, 2010 9:47 am
by zet
And another related question.
Is it possible to convert links from my inner representation to plain-text during copying to buffer? Or rvf is also copied as is?

Posted: Tue Oct 12, 2010 10:03 am
by Sergey Tkachenko
I corrected my code.
Yes, RVF is copied as it is. You can process OnCopy to copy selection in a hidden editor, modify this editor, then call its SelectAll and CopyDef.

Posted: Tue Oct 12, 2010 11:14 am
by zet
Thank you.