Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help about grid
Message
De
01/12/2004 23:59:55
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, États-Unis
 
 
À
30/11/2004 04:24:24
Reza Meamar
Homa Programming Group
Shiraz, Iran
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows '98
Database:
Visual FoxPro
Divers
Thread ID:
00965638
Message ID:
00966270
Vues:
6
Hi Reza,
The problem with the LostFocus is you don't know which way the user is trying to go. If they press ShiftTab or LeftArrow to go the previous cell, you are still coding go forward. If you check for the LastKey(), you may get a key pressed some time ago if the user is clicking from
cell to cell.
To avoid these issues I use a navigation column of 0 width that is added to the grid as the last column. The user can't click into this column because it has no width. So when the user enters the control in the column, I can examine the LASTKEY() in the GotFocus and know which way they intend to go. There's actually quite a bit of code--too much--but this may give you the idea.
**********************************************************************
DEFINE CLASS txtNavigate AS TextBox
   Margin = 0
   ReadOnly = .T.
   *********************************
   PROCEDURE GotFocus()
      * The only way to get here is via a Keypress.  No mouse click can 
      * get a user to the 0 width column.
      LOCAL Direction
      IF INLIST(LASTKEY(), SHIFTTABKEY, LEFTARROWKEY, UPARROWKEY, HOMEKEY)
         Direction = -1
      ELSE
         Direction = +1
      ENDIF
      THIS.Parent.Parent.FocusElsewhere(m.Direction)
      RETURN
   ENDPROC
ENDDEFINE
DEFINE CLASS ColNavigate AS Column
   ADD OBJECT Header AS HdrCustom  
   ADD OBJECT txtNavigate AS txtNavigate 
   Resizable = .F.
   Width = 0      && Don't allow a mouse to get us to this column,
                  && only keystrokes.
ENDDEFINE
>hi all
>i have a grid with 4 columns and 7 rows. all of cells are textbox.
>i want when i exit from colum4 the cursor go to next row and colum2.
>i do some work but i am not satisfied.
>can anyone help me?
>thanks
Charlie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform