Jump to content


Photo

Better errormessage for CellByName


  • Please log in to reply
1 reply to this topic

#1 wvd_vegt

wvd_vegt

    Master Member

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

Posted 09 November 2005 - 12:51 PM

Hi,

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.

CODE
function TNxCustomGridControl.GetCellByVariant(ACol,

 ARow: Variant): TPoint;

begin

 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

 else

 try

   Result.Y := ARow;

 except

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

 end;



 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

 else

 try

   Result.X := ACol;

 except

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

 end;

end;

G.W. van der Vegt

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 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
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users