Jump to content


Better errormessage for CellByName

  • Please log in to reply
1 reply to this topic

#1 wvd_vegt


    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 09 November 2005 - 12:51 PM


If you change TNxCustomGridControl.GetCellByVariant in NxCustomGridControl.pas to the following code you get a much more usefull message during development:

Btw don't forget to add the 'Variants' unit to the implementation sections uses clause too.

function TNxCustomGridControl.GetCellByVariant(ACol,

 ARow: Variant): TPoint;


 if CompareText(ARow, 'First') = 0 then

   Result.Y := 0

 else if CompareText(ARow, 'Last') = 0 then

   Result.Y := Pred(RowCount)

 else if CompareText(ARow, 'Selected') = 0 then

   Result.Y := SelectedRow



   Result.Y := ARow;


   raise Exception.CreateFmt('Invalid Rowname '#39'%s'#39' for '#39'%s:%s'#39'.', [VarToStr(ARow), Self.ClassName, Self.Name]);


 if CompareText(ACol, 'First') = 0 then

   Result.X := 0

 else if CompareText(ACol, 'Last') = 0 then

   Result.X := Pred(Columns.Count)

 else if CompareText(ACol, 'Selected') = 0 then

   Result.X := SelectedColumn

 else if Columns.Column[ACol] <> nil then

   Result.X := Columns.Column[ACol].Index



   Result.X := ACol;


   raise Exception.CreateFmt('Invalid Columnname '#39'%s'#39' for '#39'%s:%s'#39'.', [VarToStr(ACol), Self.ClassName, Self.Name]);



G.W. van der Vegt

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,661 posts
  • Gender:Male

Posted 10 November 2005 - 03:00 AM

Hello Wim,

I have add it.

Thanks again
boki@bergsoft.net | LinkedIn Profile
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
BergSoft Facebook page
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users