Loading documents before displaying form

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
palmeira
Posts: 139
Joined: Mon Sep 12, 2005 10:18 pm

Loading documents before displaying form

Post by palmeira »

When I tried loading a document before showing a form, I sometimes got an exception. In order to avoid it, I changed the method ScrollBarVChange in the unit SclRView:

if OldValue <> VScrollPos then begin
if FRichViewEdit.Visible then // <==== Added line
If not FRichViewEdit.Focused then
FRichViewEdit.SetFocus;
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

You use SRV.RichViewEdit.LoadRVF? If yes, it is not correct.
You need to use SRV.LoadRVF
palmeira
Posts: 139
Joined: Mon Sep 12, 2005 10:18 pm

Post by palmeira »

Thta is the code I use to load a file:

ve1.InsertRVFFromStreamEd(st2);
NormalizeRichView(ve1.RVData);
ve1.ClearUndo;
ve1.Format;
srv.CalculatePageCount;

As there is no InsertRVFFromStreamEd in TSRichViewEdit, I am not able to use srv.InsertRVFFromStreamEd(st2).
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

ve1.InsertRVFFromStreamEd(st2);
NormalizeRichView(ve1.RVData);
ve1.ClearUndo;
srv.SetRVMargins;
palmeira
Posts: 139
Joined: Mon Sep 12, 2005 10:18 pm

Post by palmeira »

I changed the code as suggested, and now I am getting (a lot of) errors List index out of bounds. Are you sure that ve. format is not necessary after DeleteUnusedStyles, NormalizeRichView, ClearUndo? Please advise.
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

Send me a simple example and RVF a file on which I can reproduce an error that I could correct it quickly.
palmeira
Posts: 139
Joined: Mon Sep 12, 2005 10:18 pm

Post by palmeira »

I use EurekaLog to log the errors, but I do not have the documents that were being used when the errors happened - the documents are retrieved from a database, and the users somehow keep working after the error message. Anyway, this is not important - I will simply patch the source file, so that the control do not receive focus if it is not visible.
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

You are right, this is bug. It will be corrected in following updating.
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

bug fixed
Post Reply