Jump to content

Programming Hints / UniDBGrid correct RecNo


Recommended Posts

Like you know, The Database dont return correct RecNo properties everytime.

Perhaps, you must scrool all data. (with Prior, next).

 

I found a way;

 

1- Creat a new UniDBGrid field for first column. (like NO)

 

2- Copy-paste this code to  DrawColumnCell event :

 

procedure ....Form.UniDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
 
var
  vDbGrid: TDBGrid absolute Sender;
 
begin
 
  // only do the next line if this event generated for
  // the first columnn (column with index 0)
  if DataCol=0 then
    vDbGrid.Canvas.TextOut(Rect.Left + 2
                           , Rect.Top + 2
                           , IntToStr(vDbGrid.DataSource.DataSet.RecNo));
 
end;
 
 
Good programming..

 

 

 

post-2269-0-59126400-1425292577_thumb.jpg

  • Upvote 3
Link to comment
Share on other sites

  • 3 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...