Recent

Author Topic: DBGrid List index (23) out of bounds  (Read 1548 times)

universe

  • New Member
  • *
  • Posts: 20
DBGrid List index (23) out of bounds
« on: December 02, 2014, 10:23:38 am »
Hello all,
I have a database programme running fine until I added some code to the OnDrawColumnCell event of a TDBGrid the code is
Code: [Select]
procedure TfrmMain.dbgItemsDrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if Column.FieldName='designation' then
  begin
    Column.SizePriority:=0;
    Column.Width:=200;
  end;
  if Column.FieldName='item_no' then
  begin
    Column.SizePriority:=0;
    Column.Width:=150;
  end;
end;
Then the exception List index (23) out of bounds is raised randomly in
Code: [Select]
CLASSES$_$TFPLIST_$__$$_RAISEINDEXERROR$LONGINT
I saw similar forum posts talking about the OnDraw (bug) after calling clear of TChart, but I don't know if this is the same (as it's in TFPList), any suggestion?
Thanks in advance for any hint.

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: DBGrid List index (23) out of bounds
« Reply #1 on: December 02, 2014, 06:34:12 pm »
Create the smallest demo possible and attach it in a message here so we can have a look.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

universe

  • New Member
  • *
  • Posts: 20
Re: DBGrid List index (23) out of bounds
« Reply #2 on: December 03, 2014, 09:02:02 am »
Ok, I'll prepare it asap.
Thanks

 

TinyPortal © 2005-2018