rvico TRichView Reference | Tables

Editing Cells

Top  Previous  Next

Editing Cells

Then the user clicks some cell in table with the mouse, or enter to some cell using keyboard, RichViewEdit creates a special editor for this cell. This editor is referred in this documentation as cell inplace editor.

(this editor will be created only if rvtoEditing is in table Options)

This editor does not have borders and located in place of cell, creating an illusion of editing directly in main RichViewEdit.

Inplace editing is possible only when table was inserted in TRichViewEdit, not in TRichView.

When inplace editor is initiated, RichViewEdit moves all content of the cell to this editor. When editor is destroyed, RichViewEdit moves modified data back to the cell (this procedure is transparent for user).

So if you wish to access directly to cell contents, use methods of cell's GetRVData instead of methods of the cell itself.

You can initiate editing of cell from code: table.EditCell (see the example in the topic about selection in tables) or Cell.Edit.

Position of edited cell can be returned by method GetEditedCell and GetNormalizedSelectionBounds.


This mechanism of cell editing adds some limitations:

You must not destroy inplace editor from inside the following events: OnKeyDown, OnKeyUp, OnKeyPress, OnRVMouseMove, OnStartDrag, OnDragOver.

Inplace editor can be destroyed by calling RichViewEdit.Clear, or by the methods placing caret/selection outside the editing cell (RichViewEdit.SetSelectionBounds, table.EditCell, etc.). You must avoid calling these methods in these events.

If you need to perform such operation, use the following technique:

from the event, post a window message to the form (PostMessage)

in the handler procedure  for this message, perform this operation.

Example 1 (reloading on double click)

Define some constant > WM_USER:


In the form's declaration:

procedure WMReloadDoc(var Msg: TMessage); message WM_RELOADDOC;


procedure TForm1.WMReloadDoc(var Msg: TMessage);


  { code for loading here }


Double click:

procedure TForm3.RichViewEdit1DblClick(Sender: TObject);


  PostMessage(Handle, WM_RELOADDOC, 00);


Example 2:

Demos\Delphi\Assorted\Graphics\DragImg\ or


TRichView © trichview.com