rvico TRichView Reference | Item Types | Sidenote

TRVSidenoteItemInfo

Properties   Methods

Top  Previous  Next

TRVSidenoteItemInfo is a class representing a sidenote in TRichView documents. Sidenote is a note displayed in a floating box.

This is not a component. Objects of this class are created at runtime and appended to TRichView (see AddItem) or inserted into TRichViewEdit (see InsertItem). Style of this item type: rvsSidenote (-206)

Unit RVSidenote.

Syntax

TRVSidenoteItemInfo = class(TCustomRVNoteItemInfo)

(introduced in version 15)

Hierarchy

TObject

TPersistent

TCustomRVItemInfo

TRVNonTextItemInfo

TRVRectItemInfo

TRVLabelItemInfo

TRVSeqItemInfo

TCustomRVNoteItemInfo

Using

Numbering type for sidenotes is defined in SidenoteNumbering property of TRVStyle component (NumberType property, inherited from TRVSeqItemInfo, is ignored).

You can enumerate all sidenotes in documents using RVGetFirstSidenote and RVGetNextSidenote functions (these functions return text box items as well)

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

This class introduces the following properties:

BoxPosition – contains properties defining the position of the floating box

BoxProperties – contains properties describing size, background and border of the floating box.

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

Example

This example inserts a new sidenote in rveMain (TCustomRichViewEdit). TextStyleNo for this sidenote is returned by RVGetNoteTextStyleNo function basing on the rveMain.CurTextStyleNo-th style).

Document for this sidenote contains one reference (TextStyleNo for this reference is returned by RVGetNoteTextStyleNo function basing on the 0th style) and one space character of the 0th style.

A text box for this sidenote has a yellow background and a double border, and positioned by 50 pixels below the sidenote character line's top side:

var SideNote: TRVSidenoteItemInfo;

    NoteRef: TRVNoteReferenceItemInfo;

begin

  SideNote := TRVSidenoteItemInfo.CreateEx(rveMain.RVData,

    RVGetNoteTextStyleNo(rvs, rveMain.CurTextStyleNo), 1, False);

  NoteRef := TRVNoteReferenceItemInfo.CreateEx(SideNote.DocumentRVGetNoteTextStyleNo(rveMain.Style,0));

  SideNote.Document.AddItem('', NoteRef);

  SideNote.Document.AddNL(' '0, -1);

  SideNote.BoxProperties.Background.Color := clYellow;

  SideNote.BoxProperties.Border.Style := rvbDouble;

  SideNote.BoxPosition.VerticalOffset := rveMain.Style.PixelsToUnits(50);

  if rveMain.InsertItem('', SideNote) then

    ...

end;

The topic about TRVNoteReferenceItemInfo contains example showing how to edit Document.

See also

TRVTexBoxItemInfo

 


TRichView © trichview.com