Page 1 of 1

How to delete a TRVTableItemInfo from TRichView?

Posted: Tue Aug 21, 2018 2:56 pm
by wolf1860
TRichView can not DeleteSelection?
procedure DeleteTable(rve: TCustomRichViewEdit; table: TRVtableitemInfo);
var
RVData: TCustomRVData;
ItemNo: Integer;
begin
RVData := table.Cells[0, 0].GetAbsoluteParentData;
ItemNo := table.GetMyItemNo;
// Table is the ItemNo-th item in RVData.
RVData := RVData.Edit;
TCustomRVFormattedData(RVData).SetSelectionBounds(ItemNo, 0, ItemNo, 1);
rve.DeleteSelection;
end;

Re: How to delete a TRVTableItemInfo from TRichView?

Posted: Tue Aug 21, 2018 3:27 pm
by Sergey Tkachenko
DeleteSelection is an editing operation, so it is available only in editor.

In TRichView, you can use DeleteItems method.

Re: How to delete a TRVTableItemInfo from TRichView?

Posted: Tue Aug 21, 2018 3:51 pm
by wolf1860
I insert some controls to the cells, and deleteItems does not work. What's wrong with the code below?

var
table: TRVTableItemInfo;
ItemNo: Integer;
begin
table := FindTable(richView1.RVData, 'mytest1');
ItemNo := table.GetMyItemNo;
richView1.DeleteItems(ItemNo,1);
end;

Re: How to delete a TRVTableItemInfo from TRichView?

Posted: Tue Aug 21, 2018 6:16 pm
by Sergey Tkachenko
Call richview1.Format after DeleteItems.

Re: How to delete a TRVTableItemInfo from TRichView?

Posted: Wed Aug 22, 2018 2:33 pm
by wolf1860
Thank u!