Page 1 of 1

Insert image at after selected item no in TRichView

Posted: Fri Jan 06, 2017 8:52 pm
by junaid_arm
Hello, i have been searching around to look for a solution, there is no example of how to insert picture at a custom position in TRichview. TRichviewEdit have an insertpicture method but TRichview doesnt. Using AddPictureEX it only asks for ParaNo and not ItemNo.

Can anyone tell me how can i get around this issue?

Regards

Posted: Wed Jan 11, 2017 12:26 pm
by Sergey Tkachenko
TRichView does not include methods for insertion in the specified position (the only exceptions are InsertRVFFromStream and SetListMarkerInfo).
All its methods are designed for document generation, so they add new content to the end of the document.

However, RVInsertItem.pas contains some procedures for insertion, including RVInsertGraphic:

Code: Select all

procedure RVInsertGraphic(RVData: TCustomRVData; ItemNo: Integer;
  Graphic: TGraphic; Hyperlink: Boolean; ParaNo: Integer;
  VAlign: TRVVAlign = rvvaBaseline; const Tag: TRVTag = RVEMPTYTAG);
It inserts a new image in the position ItemNo.
Example:

Code: Select all

RVInsertGraphic(RichView1.RVData, 0, MyBitmap, False, 0);