Actually, the top row will be row := 0 I believe. The current position is given 
by DBGrid1.Datasource.DataLink.ActiveRecord-1;
 
What's wrong with using the hack method? Otherwise you'd have to derive a new 
grid with that property made public.
 
DJS

Zoran Milenkovic <[EMAIL PROTECTED]> wrote:
*********** ORIGINAL MESSAGE ******************
Say I am halfway into a large DBGrid table, and the cursor is half way
down the DBGrid screen.  How do I determine what line is at the top
row  of the DBGrid ?
***********************************************

First you need to determine the current row in the DBGrid (the position of the 
cursor). There is a ROW property of TCustomDBGrid, but unfortunatelly it is 
protected and I don't know how you can access it except by hacking. For example:

type THackDBGrid = class(TDBGrid);
...
var
  CurrentRow: integer;
...
  CurrentRow := THackDBGrid(MyDBGrid).Row;


Now you can access the record in the top row of MyDBGrid by using ofset 
(skiping back in the table by CurentRow number of records).

If you want to keep the cursor at it's current position, you will have to use 
Bookmarks.

Does anyone know how to read DBGrid's ROW without hacking?

Zoran



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 



---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
  
   To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


                
---------------------------------
Yahoo! Mail Mobile
 Take Yahoo! Mail with you! Check email on your mobile phone.

[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to