Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor movement in grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00472303
Message ID:
00474660
Views:
28
Thanks, Vlad! With your information and a little tweaking, I got the cursor moving just the way I wanted. Thanks for your help.

>Hi!
>
>Don;t use INKEY() function, it have the lowest priority when working with controls. The most priority have Form's event KeyPress when you set option for form KeyPreview. Than trap down arrow key and enter key in this form's event. Code there will run before event reach grid. Don't forget to put nodefault command to prevent usual behaviour of controls in response to these keys.
>
>HTH.
>
>
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform