** How to control the focus in the current object while arrow keys or backspaces tend to take the control to the next object ?
When a textbox is in focus, it is likely that a backspace or left/right arrow key or home or end key is pressed while at the initial or ending positions of the control. The default behaviour is to take the focus to the next control as if up arrow key or down arrow key is pressed. This situation cannot be controlled by the SET CONFIRM ON. This command SET CONFIRM ON only avoids the focus going to next control when excessive keyboard entry takes place. To avoid this situation you can do what has been suggested here.
1. Set the property form's property ,
myForm.KeyPreview = .t.
2. Put the code ....
*************************************************
myForm.KeyPressEvent
**************************
LPARAMETERS nKeyCode, nShiftAltCtrl
IF VARTYPE(ThisForm.lTab) = "U"
ThisForm.AddProperty("lTab",.t.)
ENDIF
IF INLIST(nKeyCode,1,4,6,19,127)
IF ThisForm.lTab
FOR EACH oControl IN ThisForm.Controls
oControl.TabStop = .f.
ENDFOR
ThisForm.lTab = .f.
ENDIF
ELSE
IF ! ThisForm.lTab
FOR EACH oControl IN ThisForm.Controls
oControl.TabStop = .t.
ENDFOR
ThisForm.lTab = .t.
ENDIF
ENDIF
*************************************************
** Note the nKeyCode values for
Right Arrow = 4
Left Arrow = 19
Home Key = 1
End Key = 6
Back Sapce key = 127
*************************************************
Home Feedback Forms VisualFoxProFAQ