TCustomRichViewEdit.TopLevelEditor.Format is giving error

General TRichView support forum. Please post your questions here
Post Reply
ranjanbag
Posts: 1
Joined: Tue Oct 02, 2012 10:34 am

TCustomRichViewEdit.TopLevelEditor.Format is giving error

Post by ranjanbag »

Hi,

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;
Sergey Tkachenko
Site Admin
Posts: 17560
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am afraid I have not enough information to find the reason of this problem.
Please create a simple project (without non-standard controls) reproducing this problem and send it to me.

I can see one possible problem: even after calling CellData.Edit, it's not necessary that Editor.TopLevelEditor is an inplace editor of this cell. It may be an inplace editor of a cell of another table inserted in CellData.
Post Reply