|
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:
GetCurrent***Info methods are equivalent to Get***Info(CurItemNo,...). But there is one important exception: when using tables, GetCurrent***Info methods return information about item at the position of caret regardless its location (in root editor or in cell inplace editor). Read-only property RichView.ItemCount returns a 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):
In editor you can use the methods above or GetCurrentBreakInfo, GetCurrentBulletInfo, GetCurrentHotspotInfo, GetCurrentPictureInfo, GetCurrentControlInfo, GetCurrentTextInfo (GetCurrent***Info methods), and GetCurrentTag, GetCurrentCheckpoint, GetCurrentItemText. The arguments of these methods are similar to the arguments of Add***Tag methods for appending items. It should be noted that these methods return references to pictures, controls, and tag strings (if there is tags-are-PChars mode) 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). Table in the position of caret (or top-level table containing caret) can be obtained with the method GetCurrentItemEx. |