Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DoScroll
Message
From
25/03/2004 16:10:17
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00889667
Message ID:
00889784
Views:
24
Hello Jonathon.

I usually leave the pointer at the bottom of the table. When a user tabs to the Grid, which is usually on a different page, he sees the last record at the top of the grid.
It would be nicer if he saw for instance the last 10 records, (with the last record hilighted).


The follow code from chapter 6 of 1001 Things You Wanted to Know About Visual FoxPro leaves the record pointer on the last record in the grid.

It is called from the form's init():
*** Display the last page of the grid when the form instantiates
IF DODEFAULT()
  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 )
    lnRecNo = RECNO( .RecordSource )
    *** Go to the record that should be in the first row of the last page
    SKIP -( lnMaxRows - 1 ) IN ( .RecordSource )	
    .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