UN-DO action ignores LoadRVFFromStream into table cells
Posted: Thu Nov 22, 2007 5:47 am
Hi Sergey,
The task:
Multi-cell-paste from a source to a target table.
Fill the contents of multiple cells from a source-table (in a separate dummy RVEditor-control) into multiple cells in a target-table (overriding any previous cell contents).
This multi-cell-paste should be un-do-able as ONE un-do-action. See code below.
The problem(s):
The un-do action is not including the direct insertions into table-cells.
LoadRVFFromStream can not be undone.
InsertRowsBelow un-do works ok though.
When using anInplaceEditor.InsertRVFFromStreamEd(tempStream), then the insertion for each individual table can be undone.
In this case multiple un-do actions are created, but now there is one for each table-cell. Also the anInplaceEditor.Clear can not be undone.
The question:
How can I group multiple direct cell insertions into one un-do group?
Thanks!
-- Lutz
The task:
Multi-cell-paste from a source to a target table.
Fill the contents of multiple cells from a source-table (in a separate dummy RVEditor-control) into multiple cells in a target-table (overriding any previous cell contents).
This multi-cell-paste should be un-do-able as ONE un-do-action. See code below.
The problem(s):
The un-do action is not including the direct insertions into table-cells.
LoadRVFFromStream can not be undone.
InsertRowsBelow un-do works ok though.
When using anInplaceEditor.InsertRVFFromStreamEd(tempStream), then the insertion for each individual table can be undone.
In this case multiple un-do actions are created, but now there is one for each table-cell. Also the anInplaceEditor.Clear can not be undone.
The question:
How can I group multiple direct cell insertions into one un-do group?
Code: Select all
// Begin Un-do sequence
itemIdx := aRVEditor.GetItemNo(aTargetTable);
BeginUndoGroup(rvutInsert);
SetUndoGroupMode(true);
aRVEditor.BeginItemModify(itemIdx, modifyData);
// Add rows to target table if necessary
iDiff := aSourceTable.RowCount - ( aTargetTable.RowCount - topRow );
if iDiff > 0 then
begin
{UN-DO WORKS OK WITH INSERTROWSBELOW}
aTargetTable.InsertRowsBelow(iDiff);
end;
// Do the insert
for r := 0 to (aSourceTable.Rows.Count-1) do
for c := 0 to (insertCols-1) do
begin
tempStream.Clear;
aSourceCell := aSourceTable.Cells[r,c];
aTargetCell := aTargetTable.Cells[(topRow + r),(leftCol + c)];
aSourceCell.SaveRVFToStream(tempStream, false, aColor, aBackground, aLayout);
tempStream.Position := 0;
{UN-DO DOES NOT WORK WITH LOADRVFFROMSTREAM}
aTargetCell.LoadRVFFromStream(tempStream, aColor, aBackground, aLayout);
{UN-DO NEITHER WORKS WITH INPLACEEDITOR}
{
aTargetTable.EditCell((topRow + r),(leftCol + c));
anInplaceEditor := aTargetTable.GetEditedCell(row, col);
anInplaceEditor.Clear;
anInplaceEditor.LoadRVFFromStreamEd(tempStream);
anInplaceEditor.Deselect;
}
end;
// End Undo sequence
aRVEditor.EndItemModify(itemIdx, modifyData);
SetUndoGroupMode(false);
-- Lutz