Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Navigating on Grid.....
Message
 
 
À
05/11/2001 02:31:55
Ransome So
Ransome's Workshop
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00577291
Message ID:
00577304
Vues:
11
>Dear all,
>
>How to code such that:
>
>1. The user can key in datas on accross the Gird rows, when one column of the row is filled, the active cell tab to next row by press <Enter>.

In the KeyPress event of control inside of each grid column add a code:
if nKeyCode = 13 && 13 is a code of Enter key
  nodefault
  KEYBOARD "{TAB}"
endif
>2. He can not go to next row unless all information on the last row are completed (i.e. the grid don't add new before the last record is filled)

In VFP7, in BeforeRowColChange you can do some checking when moving to next row, then use "nodefault" command to prevent leabing of row when it is not complete. But this is very restricting way and will nto work in VFP 6 because no way to determine what is going to change - row or column. It is much better to use AfterRowColChange event for that - check previous row (by remembering RecNo(), then using that number to go to record and check if it is completed). If it is not completed - leave that row current and show whatever warnings/messageboxes/Wait Windows required for user to notify about that. New record you can always delete if you use "AllowAddNew". To check if new record just added in AfterRowColChange event, store RecCount() somewhere, then check if RecCount() changed in AfterRowColChange. If changed - new row just added.

>3. and when the last column of the row is completed the active cell jump to the first column of next row .
>

In the AfterRowColChange event:

if cursor moved from last column to first, lastkey() was "TAB" key (code is 9), and there is a next row, then use "SKIP" command for record source and refresh the grid (if needed). When there are no last row, but you use AllowAddNew, just use APPEND BLANK command to add new row.

HTH.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform