I have the following code in our application. But some time "TCustomRichViewEdit.TopLevelEditor.Format" it is throwing error - "List Index Out of bounds(-1).
Could you please tell me what is the solution?
Code: Select all
CellData := BaseTable.Cells[CurrentRow, CurrentCol];
CellData.Edit;
RVData := CellData.GetRVData;
for nIndex := 0 to RVData.ItemCount - 1 do
begin
if (RVData.GetItemStyle(nIndex) = rvsComponent) then
begin
if (TRVControlItemInfo(RVData.GetItem(nIndex)).Control is TStrikeThru) then
begin
if TStrikethru(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).IsFromNormal then
begin
if not (TStrikethru(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).IsFromFindingsLast) then { -ogay : added condition, so that the normals coming from load last will not return to normal state }
TStrikethru(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).Status := 0;
end
end
else if (TRVControlItemInfo(RVData.GetItem(nIndex)).Control is TSmartext) then
begin
if TSmartext(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).IsFromNormal then
begin
if not (TSmartext(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).IsFromFindingsLast) then { -ogay : added condition, so that the normals coming from load last will not return to normal state }
begin
TSmartext(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).TriggeredButton := 0;
TSmartext(TRVControlItemInfo(RVData.GetItem(nIndex)).Control).MDOInvalidateSmartext;
end;
end;
end;
end;
end;
Editor.TopLevelEditor.Format;
FixColors(Editor.TopLevelEditor);
Editor.TopLevelEditor.Format;
CellData.Edit;