Jump to content


Photo

exit on the begining of TNextDBGrid.GetCellValue


  • Please log in to reply
2 replies to this topic

#1 Kedarius

Kedarius
  • Members
  • 2 posts

Posted 16 May 2016 - 01:34 PM

I was debugging a strange problem and I narrowed it down to a Next component library update. I am not exactly sure when or exactly in which Next version but I found out that there is an exit at the begining of TNextDBGrid.GetCellValue. So every call to DBGrid.CellValue[something,something] returns nil instead of the real value:

 

NxDBGrid.pas from nextcomps5_6-15.zip

function TNextDBGrid.GetCellValue(ACol, ARow: Integer): Variant;
var
  AField: TField;
  S: WideString;
begin
exit;

  Result := Null;
........

What is the reason behind it? And is there any recommended workaround? it seem that cell[] returns the correct value, so does the function when I comment out the mentioned exit.



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 16 May 2016 - 02:58 PM

Hi,

Most probably I have placed exit by mistake, after debugging. You can try to remove exit, and I will do the same in official release.

If possible, it's always better to use Columns[x].Field.AsString (AsFloat etc.) directly. When GetCellValue is used you can only "jump" to already buffered records (usually ones on the screen in non-buffered mode).
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.

#3 Kedarius

Kedarius
  • Members
  • 2 posts

Posted 16 May 2016 - 03:20 PM

I tried to remove it and now I am testing if it all works (it seems to work at first look).

 

I am usually interested only in data for selected row so it should be on the screen:

masterdbgrid.CellValue[masterdbgrid.GetColumnByFieldName(fieldname).Index, masterdbgrid.SelectedRow]

but I will try the Columns[x].Field.AsString approach...






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users