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);
  vDbGrid: TDBGrid absolute Sender;
  // 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));
Good programming..





  • Upvote 3
Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...