Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Row setting
Message
From
11/05/2001 07:44:53
 
 
To
10/05/2001 18:14:09
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00506039
Message ID:
00506146
Views:
18
Hi Todd.

>> I would like to force the grid to locate the current record on the middle row of the grid or , if there are not enoght rows to fill the remaining rows of teh grid, place the current record further down to facilitate the filling of all rows. <<

This code, from "1001 Things You Wanted to Know About VFP" (Akins, Kramek, Schummer - Hentzenwerke Publishing) will do the trick for you:
LOCAL lnMaxRows
*** Display the last page of the grid when the form instantiates
IF DODEFAULT()
   Thisform.LockScreen = .T.
   WITH Thisform.GrdCustomer
     *** Calculate the maximum number of rows per grid page
     lnMaxRows = INT( ( .Height - .HeaderHeight - ;
     IIF( INLIST( .ScrollBars, 1, 3 ), SYSMETRIC( 8 ), 0 ) ) / .RowHeight )
     GO BOTTOM IN ( .RecordSource )
     *** Go to the record that should be in the first row of the last page
     SKIP -( lnMaxRows - 1 ) IN ( .RecordSource )
     .SetFocus()
     *** Make sure it is the first relative row
     DO WHILE .RelativeRow # 1
       .DoScroll( 1 )
    ENDDO
   ENDWITH
   Thisform.LockScreen = .F.
ENDIF 
Marcia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform