How to delete a TRVTableItemInfo from TRichView?

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

How to delete a TRVTableItemInfo from TRichView?

Post 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;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to delete a TRVTableItemInfo from TRichView?

Post by Sergey Tkachenko »

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

In TRichView, you can use DeleteItems method.
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: How to delete a TRVTableItemInfo from TRichView?

Post 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;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to delete a TRVTableItemInfo from TRichView?

Post by Sergey Tkachenko »

Call richview1.Format after DeleteItems.
wolf1860
Posts: 118
Joined: Sat Nov 21, 2015 2:04 am

Re: How to delete a TRVTableItemInfo from TRichView?

Post by wolf1860 »

Thank u!
Post Reply