How to delete a TRVTableItemInfo from TRichView?

General TRichView support forum. Please post your questions here
Post Reply
wolf1860
Posts: 55
Joined: Sat Nov 21, 2015 2:04 am

How to delete a TRVTableItemInfo from TRichView?

Post by wolf1860 » Tue Aug 21, 2018 2:56 pm

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;

Sergey Tkachenko
Site Admin
Posts: 14077
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to delete a TRVTableItemInfo from TRichView?

Post by Sergey Tkachenko » Tue Aug 21, 2018 3:27 pm

DeleteSelection is an editing operation, so it is available only in editor.

In TRichView, you can use DeleteItems method.

wolf1860
Posts: 55
Joined: Sat Nov 21, 2015 2:04 am

Re: How to delete a TRVTableItemInfo from TRichView?

Post by wolf1860 » Tue Aug 21, 2018 3:51 pm

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;

Sergey Tkachenko
Site Admin
Posts: 14077
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to delete a TRVTableItemInfo from TRichView?

Post by Sergey Tkachenko » Tue Aug 21, 2018 6:16 pm

Call richview1.Format after DeleteItems.

wolf1860
Posts: 55
Joined: Sat Nov 21, 2015 2:04 am

Re: How to delete a TRVTableItemInfo from TRichView?

Post by wolf1860 » Wed Aug 22, 2018 2:33 pm

Thank u!

Post Reply