Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entering data into grid
Message
From
26/12/2002 16:21:00
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00735860
Message ID:
00735941
Views:
11
Hi Chuck,
I've done a lot of work on this type of thing--it's not easy, but it can work very reliably. I programmatically add a hidden column for the rightmost column. If the column's control.GotFocus fires, only a keystroke can have caused it.
The Grid must have a FocusElsewhere method that knows how to ActivateCell() with the appropriate DoScrolls, etc. My Grid has a lot of code in that method, because I let the user control navigation--both by row at a time (horizontally) as well as by column (vertically).
DEFINE CLASS ColNavigate AS Column
   ADD OBJECT Header AS Header  
   ADD OBJECT txtNavigate AS txtNavigate 
   Resizable = .F.
   Width = 0	&& Don't allow a mouse to get us to this column, only keystrokes.
ENDDEFINE

**********************************************************************
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
>>Chuck,
>>>Lastkey() however is last digit typed if you mean field is exited for its >>maxlength is reached.
>
>Cetin,
>No matter what I do, even using "INLIST(LASTKEY(),0,13,24)", the cursor will NOT advance to the next (new) record when maxlength is reached. It stays on the same record.
Charlie
Previous
Reply
Map
View

Click here to load this message in the networking platform