Items' "Tags" in TRichView

<< Click to display table of contents >>

Items' "Tags" in TRichView

Each item of TRichView has an associated string value tag. Tags are provided for the convenience of storing additional string value for special needs in your application. The main purpose of tags is organizing a work with a hypertext.

Do not confuse RichView items tags with "Tag" properties of TComponent descendants! (TRichView uses "Tag" properties of inserted controls for its own needs; you can set "Tag" properties of ImageList for organizing saving/loading "bullets" and "hotspots" from RVF; but this topic is about completely different tags!)

What you need to know about items tags:

if you do not want to use them – just forget about them; they always will be equal to '';

"checkpoints" also have tags; all rules for items tags work for checkpoints tags;

table cells also have tags; all rules for items tags work for checkpoints tags;

editor can clear (set to '') tags when applying different style to text according to RichViewEdit.EditorOptions;

If you want to save and load document in RVF you must provide that tag strings do not contain #1 and #2 characters;

You can use AddXXX methods which do not have Tag parameter. These functions create new items with Tag=''.

unicode Unicode note: tags are Unicode strings.

Example:

var Tag: TRVTag;

    S: TRVUnicodeString;

// Converting the first text item and its tag string to upper case

  MyRichView.GetTextInfo(0, S, Tag);

  MyRichView.SetItemText(0, UpperCase(S));

  MyRichView.SetItemTag(0, UpperCase(Tag));

Tags in older version of TRichView

In TRichView versions prior to v13.2, tags were Integers. Depending on rvoTagsArePChars Option, they can be either plain integer values or pointers to strings.

This mode can be returned by defining RVOLDTAGS in RV_Defs.inc.

See also...

TRichView methods for adding items with tags to the end of document (a tag is an optional parameter):

AddNL, AddBreak, AddPicture, AddHotspot, AddBullet, AddControl, AddBreak

TRichView methods for adding "checkpoints" with tags to the end of document (a tag is an optional parameter):

AddCheckpoint.

TRichView methods for obtaining information about items (including tags):

GetItemTag, GetBreakInfo, GetBulletInfo, GetHotspotInfo, GetPictureInfo, GetControlInfo, GetTextInfo.

TRichView methods for modifying items (including tags):

SetItemTag, SetBreakInfo, SetBulletInfo, SetHotspotInfo, SetPictureInfo, SetControlInfo.

TRichView methods allowing work with checkpoints tags:

FindCheckpointByTag, GetCheckpointInfo, SetCheckpointInfo.

TRichViewEdit methods for obtaining information about item in caret position:

GetCurrentTag, GetCurrentBreakInfo, GetCurrentBulletInfo, GetCurrentHotspotInfo, GetCurrentPictureInfo, GetCurrentControlInfo, GetCurrentTextInfo.

TRichViewEdit methods for inserting:

InsertStringTag, InsertStringATag, InsertStringWTag

TRichViewEdit methods for modifying items (including tags):

SetItemTagEd, SetBreakInfoEd, SetBulletInfoEd, SetHotspotInfoEd, SetPictureInfoEd, SetControlInfoEd.

TRichViewEdit methods for modifying information about item in caret position:

SetCurrentTag, SetCurrentBreakInfo, SetCurrentBulletInfo, SetCurrentHotspotInfo, SetCurrentPictureInfo, SetCurrentControlInfo

TRichViewEdit methods for working with checkpoints tags:

SetCheckpointInfoEd, SetCurrentCheckpointInfo.

TRichViewEdit options affecting tags:

EditorOptions.