Page 1 of 1

Create table then RichViewEdit.Clear Problem

Posted: Sat Jul 25, 2009 10:32 am
by nadirakyildiz
These codes add the table and looks fine but If I clear the RichViewEdit then get error from procedure TCustomRVData.Clear

SRE.RichViewEdit.InsertItem('', Table); This line run 2 times. If run 1 times ther isnt't any problem

I can't clear or I can't Free the form couse this problem.
Sorry For my Bad English :)

Code: Select all

var
  Table: TRVTableItemInfo;
  i: Integer;
begin

  if SL.Count > 0 then
  begin
    Table := TRVTableItemInfo.CreateEx(SL.Count, 2, SRE.RichViewEdit.RVData);
    Table.BestWidth := -100; 
    Table.CellHPadding := 3;

    for i := 0 to SL.Count - 1 do
    begin
      Table.Cells[i, 0].Clear;
      Table.Cells[i, 1].Clear;

      Table.Cells[i, 0].AddNL(SL.Strings[i], 0, 0);
      Table.Cells[i, 1].AddNL(SL2.Strings[i], 0, 0);

    end;
    Table.BorderWidth := 0;
    Table.CellBorderWidth := 0;
	
    SRE.RichViewEdit.SelectAll;
    while SRE.RichViewEdit.SearchText('[#TABLE#]', [rvseoWholeWord]) do
    begin
      SRE.RichViewEdit.InsertItem('', Table);
    end;
    SRE.RichViewEdit.Format;
	(*
	//SRE.RichViewEdit.Clear  
	// if I Clear then get error from 
	<
	procedure TCustomRVData.Clear
		- for i:=0 to Items.Count-1 do
        FreeItem(i,True);  --------error Line
		> 
	*)
  end;

Posted: Mon Jul 27, 2009 2:59 pm
by Sergey Tkachenko
You cannot insert the same item (table) several times.
Create a new table each time you want to insert it.