Jump to content


relipse

Member Since 18 Aug 2007
Offline Last Active Dec 09 2012 05:35 AM
-----

Posts I've Made

In Topic: exception class EListError with message 'List index out of bounds (363378...

09 December 2012 - 05:37 AM

The problem has been resolved, it was a faulty project, I had to recreate a new project and start from scratch.
Thanks for your help
Jim

In Topic: exception class EListError with message 'List index out of bounds (363378...

07 December 2012 - 09:14 AM

Ok, I reinstalled the components again, first removing all Nx*.bpl and Nx*.tds files in the BCB Projects folder.
Now the debugger actually goes into the .pas sourcecode
ODDLY ENOUGH IT FAILS ON THIS:

function TNextGrid.GetCellColor(ACol, ARow: Integer): TColor;
begin
  if not Columns[ACol].ParentCellColor then Result := FCells[ACol, ARow].Color    //<--- STOPS ON THIS LINE
    else Result := inherited GetCellColor(ACol, ARow);
end;


Something must be wrong because I'm not even calling this function, I am calling TNextGrid.AddRow(rowcount) and rowcount is 2
Using the debugger, it turns out ACOL is 2 and AROW is some random integer

In other words, nxg->AddRow() is actually calling function TNxCustomGridControl.GetActualCellColor(ACol, ARow: Integer): TColor;
hence the reason ARow is turning out some random integer (because its not supplied

How can I resolve this?

In Topic: exception class EListError with message 'List index out of bounds (363378...

07 December 2012 - 04:29 AM

View PostBoki (Berg), on 07 December 2012 - 04:00 AM, said:

Hello Jim,

I am not sure that I may find a problem. Can you please tell me where error occur, on which line AV jump?


The error occurs on line nxg->AddRow();

I recently changed my code to:


   nsSQLITE3::quick_results qr;
   nxg->ClearRows();
   SQLITE3 sqlite("caldo.db");
   String sql = "SELECT * FROM todos WHERE date_completed = '0' AND date_due LIKE '" +
                   FormatDateTime("yyyy\"-\"mm\"-\"dd", cal->Date) + "%'";
   sqlite.quick_exe(sql.c_str(), qr);
   if (qr.result == 0 || qr.rc != SQLITE_OK){
      init_database();
      qr.free();
      return;
   }
   if (qr.ncol == 0){ return; }
   memo->Clear();
   nxg->BeginUpdate();
   nxg->AddRow(qr.nrow);
   String col;
   for (int r = 0; r < qr.nrow; ++r){
      for (int c = 0; c < qr.ncol; ++c){
         if (r == 0){ continue; }

         char* cur = qr.result[ SQLITE3::calc_absolute_index(r, c, qr.ncol) ];
         //grab column from first row
         col = qr.result[ SQLITE3::calc_absolute_index(0, c, qr.ncol) ];
         if (col == "id"){
            nxg->Row[r-1]->Data = (void*)StrToInt(cur);
         }else if (col == "date_completed"){
            nxg->Cell[0][r-1]->AsBoolean = cur;
         }else if (col == "memo"){
            nxg->Cells[1][r-1] = cur;
         }
      }//foreach column
   }//foreach row
   qr.free();
   //nxg->BestFitColumns(bfBoth);
   nxg->EndUpdate();


and the access violation occurs inside nxg->AddRow(qr.nrow);

I think this version of components is not working I may need to reinstall an older version

Jim

In Topic: exception class EListError with message 'List index out of bounds (363378...

06 December 2012 - 10:06 PM

Please help Boki.
I installed the latest bergsoft components all over again.
I've never had this type of problem before.
When I run through it in the debugger it says only rowcount is 2 and colcount is 7 so the loop is not going out of bounds

t is the specific AddRow() call which crashes if i try to debug it, it prompts me asking me for NxGrid.pas (to debug it) and if i find the source file in my files it just hangs c++builder 6
I am pretty sure I have used AddRow() before without problems, is there a work-around?

Jim