Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor movement in grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Cursor movement in grid
Divers
Thread ID:
00472303
Message ID:
00472303
Vues:
89
Hi,

I've created a grid for entering and/or viewing student grades for a class. I want my users to be able to move up and down the grade entry column of the grid by pressing Enter, Tab, or Down Arrow.

The column of the grid in which the grade is entered has the text1 control as well as a combo box (using an alias's field for selection of the grade). So I have grdGrades.colGrade.Text1 and grdGrades.colGrade.cboGrade. (Other columns provide student name, etc, but are read only).

The grid also has a custom method Move2NextRow based on the code in the book "1001 Things YouWanted to Know About Visual FoxPro." My code for this looks like:

IF INKEY() = 24 OR INKEY() = 13 OR INKEY() = 9
* down arrow, enter, or tab key pressed so move to next row of grid
lnmaxRows = INT((THIS.colGrade.Text1.Height - THIS.HeaderHeight - ;
IIF( INLIST( THIS.ScrollBars, 1, 3), SYSMETRIC(8), 0)) / THIS.RowHeight)
WITH THIS
IF RelativeRow >= lnmaxRows
* on last row of visible part of grid; must scroll
.DoScroll(1)
ENDIF
.ActiveCell( .RelativeRow + 1, .RelativeColumn)
ENDWITH

ENDIF

When a user has view rights only, I set the grdGrades.colGrade.CurrentControl to Text1 and call my Move2NextRow grid method from the Text1 KeyPress Event. This works fine.

But when a user has rights to enter/edit a grade, I set the grdGrades.colGrade.CurrentControl to cboGrade.

Now my problem: How can I allow this user the ability to move to the next row? I can't seem to figure out where I can place the call to Move2NextRow in this situation. I've tried putting the call in both the KeyPress event and the InteractiveChange method with no luck... The response for Enter and Tab is to move to the next column in the same row. The down arrow moves to the next selection in the combo box.

Thanks in advance for any advice,
Nancy Price
Marlboro College
Marlboro, VT 05344
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform