TCustomRichView.OnItemAction

<< Click to display table of contents >>

TCustomRichView.OnItemAction

Occurs on insertion, deletion and some other modifications of item

type

  TRVItemAction = (rviaInserting, rviaInserted,

    rviaTextModifying, rviaDestroying, rviaMovingToUndoList)

 

  TRVItemActionEvent = procedure (Sender: TCustomRichView

    ItemAction: TRVItemAction; Item: TCustomRVItemInfo

    var Text: TRVUnicodeString; RVData: TCustomRVDataof object;

 

property OnItemAction: TRVItemActionEvent;

(introduced in version 1.7; modified in v18)

Parameters

Item item for which this event is generated.

Text text associated with this item. If this is a text item, this text is displayed in TRichView.

RVData – document containing Item (it can be Sender.RVData, table cell, or RVData of cell inplace-editor).

ItemAction identifies operation that calls this event.

ItemAction

Meaning

rviaInserting

The event occurs before the item is inserted in Sender (in RVData). You can modify Text.

This event also occurs when moving items to cell inplace editor and back to the cell.

rviaInserted

The event occurs after the item is inserted in the Sender (in RVData). Ignore Text parameter.

This event also occurs when moving items to cell inplace editor and back to the cell.

rviaMovingToUndoList

The event occurs when item is moved (from RVData) to undo list. Ignore Text parameter.

rviaDestroying

Occurs when item is destroyed. Ignore Text parameter. If the item is in undo/redo list, RVData is nil. Otherwise, this is an object containing this item.

rviaTextModifying

Occurs when item text (Text) is modified as a result of editing operation. Be careful when modifying text. It's highly not recommended to do any modification of Text except for replacing one characters to others.

Example (converting all text to upper case):

procedure TForm1.RichViewEdit1ItemAction(Sender: TCustomRichView;

  ItemAction: TRVItemAction; Item: TCustomRVItemInfo;

  var Text: TRVUnicodeString; RVData: TCustomRVData);

begin

  if (ItemAction in [rviaInserting, rviaTextModifying]) and

     (Item.StyleNo>=0then

    Text := AnsiUpperCase(Text);

end;

 

Warning: this event can occur from TRichView destructor (when clearing document before destruction). Be careful if you access other controls from this event, they may be already destroyed.

 

See also events:

OnControlAction.

See also methods:

GetItem;

GetItemNo.