rvico TRichView Reference | Item Types | Reference to the parent note

TRVNoteReferenceItemInfo

Properties   Methods

Top  Previous  Next

TRVNoteReferenceItemInfo is an item type referring to the parent footnote or endnote item. Objects of this class are usually appended to the footnote's or endnote's Document (see AddItem). Besides, they can be appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsNoteReference (-205).

Unit RVNote.

Syntax

TRVNoteReferenceItemInfo = class(TRVLabelItemInfo)

(introduced in version 10)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

Using

When inserted in footnote's/endnote's Document, the note reference displays the same text as the parent footnote/endnote.

When inserted in TCustomRichView, it displays NoteText.

Text for this item is calculated automatically.

Use RVGetNoteTextStyleNo to assign TextStyleNo property (in the constructor).

Use SetCurrentItemExtraIntPropertyEx and SetCurrentItemExtraStrPropertyEx to change properties of label items as editing operations.

Example

See examples in TRVFootnoteItemInfo and TRVEndNoteItemInfo showing how to insert footnote/endnote with document containing note reference.

This example shows how to edit note document in rveNote (TCustomRichViewEdit). The footnote/endnote is NoteItem.

This code copies document from footnote/endnote to the editor:

var Stream: TMemoryStream;

begin

 

  rveNote.NoteText := NoteItem.Text;

  rveNote.Clear;

  Stream := TMemoryStream.Create;

  try

    NoteItem.Document.SaveRVFToStream(Stream);

    Stream.Position := 0;

    rveNote.LoadRVFFromStream(Stream);

  finally

    Stream.Free;

  end;

  with rveNote do begin

    Format;

    SetSelectionBounds(ItemCount-1, GetOffsAfterItem(ItemCount-1),

      ItemCount-1, GetOffsAfterItem(ItemCount-1));

  end;

You can see that the text of footnote/endnote is assigned to the editor's NoteText. If this document contains note references, they will display this text.

After editing, the document can be saved back to the footnote/endnote:

  if not rveNote.Modified then

    exit;

  Stream := TMemoryStream.Create;

  try

    rveNote.SaveRVFToStream(Stream, False);

    NoteItem.ReplaceDocumentEd(Stream); 

  finally

    Stream.Free;

  end;

  rveNote.Modified := False;

See Also...

Demos:

Demos\Delphi\Editors\Notes

Demos\CBuilder\Editors\Notes


TRichView © trichview.com