Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor movement in a Grid
Message
De
09/09/2000 05:12:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00414137
Message ID:
00414580
Vues:
30
>>>I am trying to automate the movement of the cursor in a grid. After the user enters data in the default textbox of column 3, I want the cursor to stay in this colmn and move down one row. I have tried placing the appropriate SKIP command in the LostFocus method but haven't gotten the results I want. I have also tried setting the proper row and column using the ACTIVATECELL function.
>>>
>>>Any help would be appreciated
>>
>>Hi Randy,
>>
>>I created a simple test case for this and in the Column TextBox LostFocus event I placed the following code which seems to do what you want:
>>
>>NODEFAULT
>>SKIP 1
>>WITH THIS.PARENT.PARENT
>>    .ACTIVATECELL( RECNO(), 3 )
>>    .REFRESH
>>ENDWITH
>>
>>You might need to play with the parameters some to get it to function exactly the way you want, especially the RECNO() reference, since the records may not be in RECNO() order. Hopefully this will help you find your solution.
>>
>>Bill
>
>Hi Bill,
>
>I haven't had a chance to try your example, but I came up with this (not so elegant, but it works) solution in the KeyPress method
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>* Cursor movement code. Moves the cursor up or down in same column
>LOCAL lnrecs, lcalias, lnRecno, lnRowNo
>
>IF nKeyCode = 13 && ENTER
>
> CLEAR TYPEAHEAD
>
> lcalias = ALIAS()
> lnrecs = RECCOUNT(lcAlias)
> lnRecno = RECNO(lcAlias)
>
>* Move the cursor to the next or previous record.
> IF lnrecs > 1
> IF lnRecno = lnrecs
> KEYBOARD '{UPARROW}'
> ELSE
> KEYBOARD '{DNARROW}'
> ENDIF
> ENDIF
> NODEFAULT
>ENDIF nKeyCode = '{ENTER}'
>
>I thank you and will give your code a try.
>
>Thanks again,


Randy,
Just keep in mind to use this code in that particular grid.textbox. This code depends on (set order to 0) no order. Also instead of alias() use this.Parent.Parent.RecordSource to prevent some headaches.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform