When I add an .rvf file at the end of the current rvf i sometimes get a listindex out of bound error at the line:
2027 OnNonText(TRVRectItemInfo(li), dli); in the unit CRVFDATA
What can be the problem?
Listindex out of bound
Here is the code I use. The problems seems to occur when I fill the labelitems with tekst from a database??
Code: Select all
with SRichViewEdit1 do
begin
//move to the end of document
ItemNo := RichViewEdit.ItemCount-1;
if ItemNo<>-1 then
begin
Offs := RichViewEdit.GetOffsAfterItem(ItemNo);
RichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);
end;
RichViewEdit.InsertRVFFromFileEd(FileName);
FillFields(RichViewEdit.RVData);
//move to the end of document
ItemNo := RichViewEdit.ItemCount-1;
if ItemNo<>-1 then
begin
Offs := RichViewEdit.GetOffsAfterItem(ItemNo);
RichViewEdit.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);
end;
end;
procedure FillFields(RVData: TCustomRVData);
var i,r,c: Integer;
table: TRVTableItemInfo;
FieldName: String;
begin
for i := 0 to RVData.ItemCount-1 do
case RVData.GetItemStyle(i) of
rvsLabel:
begin
FieldName := PChar(RVData.GetItemTag(i));
if IsFieldCode(FieldName) and (pos('<',TRVLabelItemInfo (RVData.GetItem(i)).Text)<>0) then
begin
TRVLabelItemInfo(RVData.GetItem(i)).Text := GetFieldValueFromDatabase(FieldName, True);
TRVLabelItemInfo(RVData.GetItem(i)).ApplyStyleConversion(RVData,i,2);
end;
end;
end;
end;
Error only at use SRV? If you use TRichViewEdit instead of TSRichViewEdit this error repeats?
Try to switch off before filling of fields updating at SRV:
Try to switch off before filling of fields updating at SRV:
Code: Select all
SRV.CanUpdate := False;
....
SRV.CanUpdate := True;
I tried to add CanUpdate suggestion but it still gave the error.
Your other suggestions I could not try because i have to change the complete editor code.
It seems to happen when I open another setlists with more songs than used the previous time I openend the EditorFOrm. That sounds like the items in the form are still present and not deleted??!!
Should the items added to the form be cleared when the form is closed?? can that be the problem maybe??
Your other suggestions I could not try because i have to change the complete editor code.
It seems to happen when I open another setlists with more songs than used the previous time I openend the EditorFOrm. That sounds like the items in the form are still present and not deleted??!!
Should the items added to the form be cleared when the form is closed?? can that be the problem maybe??
-
- Site Admin
- Posts: 17553
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I can see the following problems:
1) Since FillFields modify the document using non-editing methods (such as assignment to LabelItem.Text), Format method must be called after it.
2) Item.ApplyStyleConversion is not supposed to be called directly, not the conversion you expect may be applied.
I am still not sure if the is the reason of this problem.
1) Since FillFields modify the document using non-editing methods (such as assignment to LabelItem.Text), Format method must be called after it.
2) Item.ApplyStyleConversion is not supposed to be called directly, not the conversion you expect may be applied.
I am still not sure if the is the reason of this problem.