Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DoScroll
Message
De
25/03/2004 16:10:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00889667
Message ID:
00889784
Vues:
26
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform