Chad Linville
Programmer
A "feature" of Foxpro is going to the next or previous tab stop when typing or backspacing.
When the user backspaces and it continues backspacing to and through the previous tab stop, try this.
Place this code in the form.init to bind all KeyPresses to the form's keypress:
Place this in the form.keypress method to capture the backspace code, 127:
To prevent moving forward to the next tab stop automatically when you're happily typing along and reach the end of the field MaxLength, putting SET CONFIRM ON in the form.init seems to do the trick.
When the user backspaces and it continues backspacing to and through the previous tab stop, try this.
Place this code in the form.init to bind all KeyPresses to the form's keypress:
Code:
* Stop backspacing through textboxes
FOR EACH loctl IN thisform.Controls
DO case
CASE INLIST(loctl.baseclass,'Textbox','Combobox','Listbox','Editbox')
BINDEVENT(loctl, "KeyPress", thisform, "KeyPress")
ENDCASE
NEXT
Place this in the form.keypress method to capture the backspace code, 127:
Code:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF INLIST(thisform.ActiveControl.baseclass,'Textbox','Combobox','Listbox','Editbox')
C_SelStart = thisform.ActiveControl.SelStart
C_SelLength = thisform.ActiveControl.SelLength
IF nKeyCode = 127 AND C_SelStart = 0 AND C_SelLength = 0
NODEFAULT
ENDIF
ENDIF
To prevent moving forward to the next tab stop automatically when you're happily typing along and reach the end of the field MaxLength, putting SET CONFIRM ON in the form.init seems to do the trick.