Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Row setting
Message
From
11/05/2001 08:11:18
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
11/05/2001 07:44:53
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00506039
Message ID:
00506148
Views:
19
Marcia,

What if I wanted to keep the active row always in the middle of the page? Sort of letting the grid move around the row so-to-speak.

Regards, Renoir


>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
Reply
Map
View

Click here to load this message in the networking platform