rvico TRichView Reference | TRichView

TCustomRichView.OnItemAction

Top  Previous  Next

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: TRVRawByteString; RVData: TCustomRVData) of object;

 

property OnItemAction: TRVItemActionEvent;

(introduced in version 1.7)

Parameters

Itemitem for which this event is generated.

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

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 non-Unicode text to upper case):

procedure TForm1.RichViewEdit1ItemAction(Sender: TCustomRichView;

  ItemAction: TRVItemAction; Item: TCustomRVItemInfo;

  var Text: TRVRawByteString; RVData: TCustomRVData);

begin

  if (ItemAction in [rviaInserting, rviaTextModifying]) and

     (Item.StyleNo>=0and 

     not (rvioUnicode in Item.ItemOptions) then

    Text := AnsiUpperCase(Text);

end;

 

Warning: this event can occur from RichView 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.


TRichView © trichview.com