|Top Previous Next|
Occurs when some action needs a style for an editing operation.
TRVStyleNeededEvent = procedure (Sender: TrvAction; RVStyle: TRVStyle;
StyleInfo: TCustomRVInfo; var StyleNo: Integer) of object;
property OnStyleNeeded: TRVStyleNeededEvent;
Actions may need text, paragraph and list styles.
StyleInfo is a sample of the required style. Sender needs a style with properties like in StyleInfo.
Depending on the style type, StyleInfo can be of TFontInfo, TParaInfo, or TRVListInfo class.
You need to return StyleNo, the index of style in the proper collection (TextStyles, ParaStyles, ListStyles) of RVStyle component. If you return -1, the action will perform a default processing (reusing existing styles if possible, adding new styles otherwise).
This event is rarely used. You can use it, for example, to disallow adding new styles (always return an index of an existing style the most similar to StyleInfo). Or you can prevent some style attributes from appearing in document as a result of editing operation (by changing StyleInfo properties and returning -1 in StyleNo).
RichViewActions © trichview.com