Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Want record to always be last row of grid
Message
From
11/11/2003 11:11:07
 
 
To
11/11/2003 09:19:04
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00848673
Message ID:
00848739
Views:
15
Hello Hetty.

My questions is....How to I get the current record to always be on the 27th row whenever they move within the grid?

This code will position the the user on the last row of the grid when the form instantiates, also making sure that the page is filled if there are enough grid rows to fill the page. Hope it will get you started:
*** Display the last page of the grid when the form instantiates
IF DODEFAULT()
  WITH Thisform.MyGrid
    *** 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 )
    lnRecNo = RECNO( .RecordSource )
    *** Go to the record that should be in the first row of the last page
    IF lnMaxRows < RECCOUNT( .RecordSource )
      SKIP -( lnMaxRows - 1 ) IN ( .RecordSource )
    ELSE
      GO TOP IN ( .RecordSource )
    ENDIF	
    .SetFocus()
    IF .RelativeRow < 1
      *** Make sure it is the first relative row 
      DO WHILE .RelativeRow # 1
        .DoScroll( 0 )
      ENDDO	
    ELSE
      DO WHILE .RelativeRow # 1
        .DoScroll( 1 )
      ENDDO  
    ENDIF 
    *!* Now go back to the last record in the grid
    GO lnRecNo IN ( .RecordSource )
    .SetFocus() 
  ENDWITH
ENDIF	
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform