Infos about a table which is in the cell of another table

General TRichView support forum. Please post your questions here
Post Reply
j&b

Infos about a table which is in the cell of another table

Post by j&b »

Hello Sergey,

all table operations are well (although copy and paste col-/rowContent from rveTable1 to rveTable2). Thank you for your help.
But I get errors if I want to delete a row of a rveTable which is in the cell of another rveTable.
I tried many things, but it seems not to be possible to delete, insert etc if a rveTable is in the cell of another rveTable.

How can I get the information that a rveTable is in the cell of another table (in order to break my project (Vorhaben) off) ?

Best regards,

Jürgen
j&b

Infos about a table which is in the cell of another table

Post by j&b »

If I copy row- or columnContent to another rveTable all ok. But when I do this with a rveTable in the cell of another rveTable screen was froozen though program runs about the line SendMessage(rve.Handle, WM_SETREDRAW, 1, 0) in TForm1.CopyTableRowEd / TForm1.CopyTableColumnEd.
If I delete the lines with SendMessage(rve.Handle, WM_SETREDRAW, 0/1, 0) I get in the memos ANSI-text.

The problem is solved:

if I rename SendMessage(RVE.Handle, WM_SETREDRAW, 0, 0)
to SendMessage(MEMO.Handle, WM_SETREDRAW, 0, 0);
and SendMessage(rve.Handle, WM_SETREDRAW, 1, 0)
to SendMessage(memo.Handle, WM_SETREDRAW, 1, 0);
in TForm1.CopyTableRowEd / TForm1.CopyTableColumnEd

then all ok (MEMO is my TDBRichViewEdit 1.9.18.1)
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code for deleting selected rows is copied from Demos\Delphi\Editor 1\ (with some modifications)

Code: Select all

var item: TCustomRVItemInfo;
    table: TRVTableItemInfo;
    Data: Integer;
    r,c,cs,rs: Integer;
    rve: TCustomRichViewEdit;
    ItemNo: Integer;
begin
  if not MEMO.CanChange or
     not MEMO.GetCurrentItemEx(TRVTableItemInfo, rve, item) then
    exit;
  table := TRVTableItemInfo(item);
  ItemNo := rve.GetItemNo(table);
  rve.BeginItemModify(ItemNo, Data);
  table.GetNormalizedSelectionBounds(True,r,c,cs,rs);
  if rs=table.Rows.Count then begin
    // deleting whole table
    rve.SetSelectionBounds(ItemNo,0,ItemNo,1);
    rve.DeleteSelection;
    exit;
  end;
  rve.BeginUndoGroup(rvutModifyItem);
  rve.SetUndoGroupMode(True);
  try
    table.DeleteSelectedRows;
    // it's possible all-nil rows/cols appear after deleting
    table.DeleteEmptyRows;
    table.DeleteEmptyCols;
  finally
    rve.SetUndoGroupMode(False);
  end;
  rve.EndItemModify(ItemNo, Data);
  rve.Change;
end;
Post Reply