>I'm working on a form that has KeyPreview set to .T. and code in the form-level KeyPress. I'm finding that in some circumstances, the control's KeyPress doesn't fire after the form's KeyPress. In particular, it happens when I press Tab in a textbox on this form. The result in this case is that the next control in tab order is receiving the tab key, and focus is jumping two controls.
>
>Both the form and textbox are based on subclasses and I can't duplicate this with base classes, so I know it's something I'm doing.
>
>The code in the form class's KeyPress looks like this:
>
>
>IF This.TestSomething(nKeyCode)
> This.DoSomething()
>ENDIF
>
>DODEFAULT(nKeyCode, nShiftAltCtrl)
>
>
>In my testing, This.TestSomething() is returning .F., as it should, so This.DoSomething() is never called.
>
>To see what's happening, I've used event tracking as well as DEBUGOUT in the form and control KeyPress events.
>
>Any ideas what could suppress the control KeyPress at this level?
>
>Tamar
Remove dodef(), VFP execute the form::keypress code after the form's keypress end.
Another, different, way is to add a nodefault