Page 1 of 1
[Bug] DeleteParas
Posted: Thu Jun 06, 2013 5:29 pm
by Jacek Puczynski
Hi,
It was a long time now I reported some bugs here.
But I believe I found a bug in TRichView last versions.
After calling DeleteParas(0, 1); at least one time on a full TRichView a text and displaying the component in a visible window:
List index out of bounds
Best regards,
Jacek
Posted: Fri Jun 07, 2013 12:38 pm
by Sergey Tkachenko
1) Please give step-by-step instructions how to reproduce this problem (or send a sample project to richviewgmailcom)
I tried to reproduce the problem by adding in the ActionTestUni a new toolbar button with the code:
Code: Select all
procedure TForm3.ToolButton71Click(Sender: TObject);
begin
RichViewEdit1.DeleteParas(0, 1);
end;
I can see no problems.
2) What exactly version of TRichView do you use?
Posted: Fri Jun 07, 2013 9:00 pm
by Jacek Puczynski
I tested on versions: TRichView v14.5.1 and TRichView 14.0 and they contain this error.
Previously I used TRichView 12 and there was no error of this kind. Also TRichView 13 seems not to have it.
I am implementing a rolling log window with TRichView (not TRichViewEdit as in your code). I have TRichView and a TRVStyle and I simply add paragraphs until the limit is reached:
Code: Select all
richView->Add(someText, C_NORMAL);
richView->FormatTail();
if(richView->ItemCount > TEXT_LIMIT)) {
richView->DeleteParas(0, 1);
}
If I set TEXT_LIMIT to 200 for example, the error that will appear will be e.g. List index out of bounds (211).
So the component tries to read an index little larger than the limit.
I hope it explains more.
Posted: Fri Jun 07, 2013 9:09 pm
by Jacek Puczynski
I forgot about AddNL it might have some impact so it looks more like:
Code: Select all
richView->AddNL(Now().FormatString(timestamp), C_TIME, 0);
richView->Add(someText, C_NORMAL);
richView->FormatTail();
if(richView->ItemCount > TEXT_LIMIT)) {
richView->DeleteParas(0, 1);
}
Posted: Sat Jun 08, 2013 6:31 am
by Sergey Tkachenko
I tried to reproduce it. Created a new Delphi project, placed RichView1 and RVStyle1, linked RichView1 to RVStyle, added a button with the code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
richView1.AddNL(DateTimeToStr(Now)+' ', 1, 0);
richView1.Add('I am implementing a rolling log window with TRichView (not TRichViewEdit as in your code). I have TRichView and a TRVStyle and I simply add paragraphs until the limit is reached', 0);
richView1.FormatTail;
if richView1.ItemCount > 20 then
richView1.DeleteParas(0, 1);
end;
No error.
But I have TRichView version modified since TRichView 14.5.1.
Today I plan to upload the update, so you will be able to test with a new version.
But, for any case, can you post a stack at the moment of exception?
(compile your application with the compiler options: Optimization: Off, Stack frames: On); when the exception occurs, go View | Debug Windows | Call Stack, Ctrl+A to select, Ctrl+C to copy)
Posted: Sat Jun 08, 2013 9:11 am
by Jacek Puczynski
Hi Sergey,
Yes I will be able to do it. I will need to also change the version I am using as now. I installed version 3.x to avoid the issue.
Please note that you are using limit 20. I suggested limit 200 because it was more realistic test with the control being scrolled vertically. (My real limit in my application in production is 7000)
I have also set the flag richView->Options << rvoScrollToEnd;
Jacek
Posted: Sat Jun 08, 2013 12:48 pm
by Sergey Tkachenko
I used 200 initially.
rvoScrollToEnd is included by default.
Posted: Mon Jun 10, 2013 12:54 pm
by Sergey Tkachenko
New version is uploaded