Reading Information about Items of RichView
|Top Previous Next|
There are two groups of methods that can be used to obtain information about items of RichView:
▪Get***Info methods, introduced in RichView, can be used to get information about any item;
▪GetCurrent***Info methods of RichViewEdit, return information about the "current" (at the caret position) item.
GetCurrent***Info methods are equivalent to Get***Info(CurItemNo,...). But there is one important exception: when using tables, GetCurrent***Info methods return information about the item at the position of caret regardless its location (in root editor or in cell inplace editor).
Read-only property RichView.ItemCount returns the number of items.
function RichView.GetItemStyle(ItemNo: Integer): Integer;
This method returns style (type) of item with the specified index.
If the returned value>=0 then this is a text item and the returned value is an index in the collection of text styles (RichView.Style.TextStyles).
If the returned value <0 then this is a special item. Negative value could be equal to one of the following constants:
See also: rvsXXX constants)
When you know a type of item you can get further information about it with the methods (Get***Info methods):
▪For any item you can get its text (text for text item, name for non-text item) (GetItemText)
In editor you can use the methods above or GetCurrentBreakInfo, GetCurrentBulletInfo, GetCurrentHotspotInfo, GetCurrentPictureInfo, GetCurrentControlInfo, GetCurrentTextInfo (GetCurrent***Info methods), and GetCurrentTag, GetCurrentCheckpoint, GetCurrentItemText.
It should be noted that these methods return references to pictures and controls owned by RichView, not to their copy. Please use them wisely. For example, you can draw something on the returned picture but you should not destroy it. The preferred way to modify items of RichView is using Set***Info (or Set***InfoEd for editor). Exception: items with rvepShared property.
A table in the position of the caret (or a top-level table containing the caret) can be obtained with the method GetCurrentItemEx.
TRichView © trichview.com