Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Lock Cursor In A Grid Column
Message
De
15/07/2002 08:44:42
 
 
À
15/07/2002 08:35:06
Raza Malik
Universal Accounting Software
Edgewater, New Jersey, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00678633
Message ID:
00678636
Vues:
15
Is the a way to lock the cursor to stay in the same column in a multi column grid. For example when pressing the key, the cursor should move to the save column in the next row.

Create a custom text box class and add a method to it called Move2NextRow. Call it from the Text box's KeyPress like this:
IF nKeyCode = 13 OR nKeyCode = 9	&& Enter or Tab
  This.Move2NextRow()
  NODEFAULT
ENDIF	
This code goes in the Move2NextRow method:
LOCAL lnMaxRows

WITH This.Parent.Parent
  *** Calculate the maximum number of rows in the grid
  lnMaxRows = INT( ( .Height - .HeaderHeight - ;
    IIF( INLIST( .ScrollBars, 1, 3 ), SYSMETRIC( 8 ), 0 ) ) / .RowHeight )
  IF .RelativeRow >= lnMaxRows
    *** This means we are on the last row in the visible portion of the grid
    *** So we have to scroll the grid down one line   	
    .DoScroll( 1 )
  ENDIF   
  .ActivateCell( .RelativeRow + 1, .RelativeColumn )
ENDWITH
Use this text box in your grid column instead of the VFP base class.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform