Page 1 of 1

Loading documents before displaying form

Posted: Fri Jun 26, 2009 2:37 pm
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;

Posted: Wed Jul 01, 2009 9:44 am
by proxy3d
You use SRV.RichViewEdit.LoadRVF? If yes, it is not correct.
You need to use SRV.LoadRVF

Posted: Thu Jul 02, 2009 6:23 pm
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).

Posted: Thu Jul 02, 2009 8:07 pm
by proxy3d
ve1.InsertRVFFromStreamEd(st2);
NormalizeRichView(ve1.RVData);
ve1.ClearUndo;
srv.SetRVMargins;

Posted: Fri Jul 03, 2009 3:33 pm
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.

Posted: Fri Jul 03, 2009 11:35 pm
by proxy3d
Send me a simple example and RVF a file on which I can reproduce an error that I could correct it quickly.

Posted: Mon Jul 06, 2009 4:47 pm
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.

Posted: Thu Jul 09, 2009 12:21 pm
by proxy3d
You are right, this is bug. It will be corrected in following updating.

Posted: Thu Jul 09, 2009 6:57 pm
by proxy3d
bug fixed