TCustomRVData.Edit

<< Click to display table of contents >>

TCustomRVData.Edit

Initializes editor for this RVData.

function Edit: TCustomRVData;

For RVData of editor (main editor, or cell inplace editor), this method does nothing.

For table cell, this method creates cell inplace editor and returns its RVData.

If you want to select part of document in table cell, call Cell.Edit (or table.EditCell) before calling cell.SetSelectionBounds or cell.SelectAll.

This method must be called when the document is formatted.

Return value

GetRVData of the given RVData after initialization of editing.

 

Example

This example deletes all controls from rve: TRichViewEdit as an editing operation (that can be undone and redone by the user).

In this example, all references to the methods and properties of TCustomRVFormattedData point to the methods and properties of TRichView. TCustomRVFormattedData has all these methods and properties, with the same meaning.

procedure DeleteAllControls(RVData: TCustomRVData;

  rve: TCustomRichViewEdit);

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  i := 0;

  while i<RVData.ItemCount do begin

    case RVData.GetItemStyle(i) of

    rvsComponent:

      begin

        RVData := RVData.Edit;

        TCustomRVFormattedData(RVData).SetSelectionBounds(i, 0, i, 1);

        rve.DeleteSelection;

        i := rve.TopLevelEditor.CurItemNo-1;

      end;

    rvsTable:

      begin

        table := TRVTableItemInfo(RVData.GetItem(i));

        for r := 0 to table.RowCount-1 do

          for c := 0 to table.ColCount-1 do

            if table.Cells[r,c]<>nil then

              DeleteAllControls(table.Cells[r,c].GetRVData, rve);

      end;

    end// of case

    inc(i);

  end// of while

end;

Call:

DeleteAllControls(rve.RVData, rve);