|
Modifying RichView Items |
Top Previous Next |
|
There are several groups of methods for modifying content of RichView:
SetCurrent***Info methods are equivalent to Set***InfoEd(CurItemNo,...) But there is one important exception – when using tables, SetCurrent***Info methods modify item in the position of caret regardless its location (in the root editor or in cell inplace editor). You cannot change a type of item (except for conversion pictures to hot-pictures and vice versa) First, you need to know a type of item. You can use RichView.GetItemStyle(ItemNo). Or you can use CurItemStyle property of RichViewEdit for the item in the position of caret. Next, you usually need to get information about the given item. Finally, you can modify it. Set***Info methods The arguments of these methods are similar to the arguments of Add*** methods. For the specified items you can use
You can also use:
Please read the topic about "tags" if you want to change tags of items. The limitations of this version are:
It is not recommended to use these methods in editor, see Viewer vs Editor Set***InfoEd methods (editor) The same set of methods as Set***Info methods, with the same arguments, but they are editor-style methods. SetBreakInfoEd, SetBulletInfoEd, SetHotspotInfoEd, SetPictureInfoEd, SetControlInfoEd; also SetItemTagEd, SetCheckpointInfoEd, SetItemTextEd, SetItemExtraIntPropertyEd, SetItemExtraStrPropertyEd SetCurrent***Info methods (editor) The same as Set***InfoEd methods, but they work with the current (in position of caret) item. SetCurrentBreakInfo, SetCurrentBulletInfo, SetCurrentHotspotInfo, SetCurrentPictureInfo, SetCurrentControlInfo, also SetCurrentTag, SetCurrentCheckpointInfo, SetCurrentItemText, SetCurrentItemExtraIntProperty, SetCurrentItemExtraStrProperty. Additional methods for controls There are some special methods for resizing inserted controls in editor. procedure ResizeControl(ItemNo, NewWidth, NewHeight: Integer); procedure ResizeCurrentControl(NewWidth, NewHeight: Integer); This is the preferred way to change size of the control. These methods reformat the affected part of document and repaint it. If your control can sometimes change its size or move itself, you need to call procedure AdjustControlPlacement(ItemNo: Integer); procedure AdjustControlPlacement2(Control: TControl); after such actions. These methods restore the correct position of the control and make all necessary reformatting and repainting if the control was resized. |