Page 1 of 1

Undo Problem

Posted: Mon Oct 08, 2007 6:46 am
by yoon jin suk
Hi.

I uses trichviewEdit v1.9.38 for delphi 7.

When a Page break is working..and the table exists..
the undo doesn't work well.

Please help me.

Posted: Tue Oct 09, 2007 12:56 pm
by Sergey Tkachenko
You should not be able to insert page break in table cells.

Posted: Wed Oct 10, 2007 2:02 am
by yoon jin suk
You mean that if table exist then TRichViewEdit's page break option
must be false?

I must use page break by default.
And My Edit uses table very much.

How can I use 'Undo' function well?

Posted: Wed Oct 10, 2007 7:26 am
by Sergey Tkachenko
When caret is inside table, you can call code to split this table in two parts and insert page break between: http://www.trichview.com/forums/viewtopic.php?t=586
Otherwise, this command must be disabled when the caret is inside table cell (when RichViewEdit.InplaceEditor<>nil)

Posted: Thu Oct 11, 2007 4:43 am
by yoon jin suk
I found my Edit's bug.

I uses RVPrint.OnFormatting event to change the table when the edit is
printed.

----------------------------------------------------------------------------------
procedure TfEditorMain.RVPrint1Formatting(Sender: TCustomRichView;
PageCompleted: Integer; Step: TRVPrintingStep);
var
i: integer;
table : TRVTableItemInfo;
begin
if step = rvpsStarting then
begin
for i := 0 to RichViewEdit1.RVData.Items.Count - 1 do
if RichViewEdit1.RVData.GetItemStyle(i) = rvsTable then
begin
table := TRVTableItemInfo(RichViewEdit1.RVData.GetItem(i));
table.CellVSpacing := 0;
table.CellHSpacing := 0;
table.bestwidth := table.width-42;
table.OnDrawBorder := DoDrawBorder;
end;
end
else if step = rvpsFinished then
begin
for i := 0 to RichViewEdit1.RVData.Items.Count - 1 do
if RichViewEdit1.RVData.GetItemStyle(i) = rvsTable then
begin
table := TRVTableItemInfo(RichViewEdit1.RVData.GetItem(i));
table.CellVSpacing := -1;
table.CellHSpacing := -1;
table.bestwidth := table.width;
table.OnDrawBorder := DoDrawBorder;
table.Changed;
end;
end;
end;
------------------------------------------------------------------------------

If page break is working and the above event is also working then
the undo event works abnormally.(If Table exists)

So... I will use above event exactly when I printing.

However ..If page break is working ..and below code is in button
click event.. and click event is accured..
---------------
RichViewEdit1.InsertRVFFromStreamEd(s);
---------------

then.. the undo event works but exception accured.

Please answer how to use 'undo' fuction..
When I uses page break and InsertRVFFromStreamEd at the same time.

Posted: Thu Oct 11, 2007 8:18 am
by Sergey Tkachenko
You cannot use this event to make changes in document. Any error is possible if you do it.
Please redesign your application to make changes in another place.