Hi
I´m using TRichView version 14.5 and database SqLite.
I have a problem with tdbrichviewedit (with autodisplay = True). This uses a blob field.
When I insert a new record and try to include a bullet in tdbrichviewedit edition, it gives me an error 'list index out of bounds (0)'.
If, in the insert of the new record, is included the instruction tdbrichviewedit1.InserText ('', false), the error disappears and everything works well.
Before, with TRichView version 13, including the bullet worked fine in the same conditions, without the instruction tdbrichviewedit1.InserText ('', false).
Any ideas or suggestions? (I could not reproduce the problem in a small example, to send)
thanks in advance
Error bounds with bullet
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
With a button that contains the next code:
Thank for your attention
Code: Select all
procedure TSDIAppForm.btnBulletClick(Sender: TObject);
begin
if not btnBullet.Down then
TDBRichViewEdit1.RemoveLists(False)
else
TDBRichViewEdit1.ApplyListStyle(CreateBullet,0,0,False,False);
end;
{ Returns index of bulleted list style. Creates it, if necessary }
function TSDIAppForm.CreateBullet: Integer;
var ListStyle: TRVListInfo;
i: Integer;
begin
{ 1. Creating desired list style }
ListStyle := TRVListInfo.Create(nil);
for i := 0 to 8 do
with ListStyle.Levels.Add do begin
ListType := rvlstBullet;
case i mod 3 of
0:
begin
Font.Name := 'Symbol';
Font.Charset := SYMBOL_CHARSET;
FormatString := {$IFDEF RVUNICODESTR}#$00B7{$ELSE}#$B7{$ENDIF};
end;
1:
begin
Font.Name := 'Courier New';
Font.Charset := ANSI_CHARSET;
FormatString := 'o';
end;
2:
begin
Font.Name := 'Wingdings';
Font.Charset := SYMBOL_CHARSET;
FormatString := {$IFDEF RVUNICODESTR}#$00A7{$ELSE}#$A7{$ENDIF};
end;
end;
Font.Size := 12;
FirstIndent := 0;
LeftIndent := (i+1) * DEF_INDENT;
MarkerIndent := i * DEF_INDENT;
end;
{ 2. Searching for existing style with these properties.
Creating it, if not found }
Result := TDBRichViewEdit1.ListStyles.FindSuchStyle(ListStyle, True);
ListStyle.Free;
end;
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Hi
Have just sent an email with accompanying rar file.
It is compiled in Delphi XE2 with TRichview 14.5 and Devart Unidac.
If you press empty insert button and attempt press bullet button then appear error 'List index out of bounds'.
If you press text insert button and attempt press bullet button then work fine.
I think that it happens when database field is null. With previous TRichview version it works fine, in this case.
Thank in advance for your attention.
Have just sent an email with accompanying rar file.
It is compiled in Delphi XE2 with TRichview 14.5 and Devart Unidac.
If you press empty insert button and attempt press bullet button then appear error 'List index out of bounds'.
If you press text insert button and attempt press bullet button then work fine.
I think that it happens when database field is null. With previous TRichview version it works fine, in this case.
Thank in advance for your attention.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
There is the following problem.
First, CreateVinnetas is called, it adds a list style.
Next, ApplyListStyle is called. At the beginning, it changes a dataset to the editing mode; while it happens, a document is reloaded, so a list style added at the first step is removed. Then, the methods tries to apply an non-existent list style, that leads to an error.
Solution: changing a database to the editing state before adding a list style:
First, CreateVinnetas is called, it adds a list style.
Next, ApplyListStyle is called. At the beginning, it changes a dataset to the editing mode; while it happens, a document is reloaded, so a list style added at the first step is removed. Then, the methods tries to apply an non-existent list style, that leads to an error.
Solution: changing a database to the editing state before adding a list style:
Code: Select all
procedure TForm1.btnBulletClick(Sender: TObject);
begin
if not btnBullet.Down then
EditorNotas.RemoveLists(False)
else begin
[color=red]if not EditorNotas.CanChange then
exit;[/color]
EditorNotas.ApplyListStyle(CreateVinnetas,0,0,False,False);
end;
end;