Instead of KeyPress, try using InteractiveChange.
do case
case up-arrow
up-arrow stuff
case down-arrow
down-arrow stuff
otherwise
dodefault()
endcase
I think this will work better, as the InteractiveChange is fired with each key entered.
HTH
Barbara
>I have spent too long trying to figure out the solution to a problem I am having.
>
>I wish to intercept keystrokes in a textbox to change the behavior upon the up or down arrow being pressed. I defined Keypress the following way: (pseudo-code follows)
>
>if param1 = the up arrow
> process up arrow
>else
> if param1 = the down arrow
> process the down arrow
> else
> baseclass::keypress(param1, param2)
> endif
>endif
>
>This did not work correctly due to VFP's way of handling functions that are overridden. If I typed a '1', I was shocked to find two ones being displayed. Apparently, the baseclass's keypress is automatically called, whether you wat it or not. This shocked my since there are other instances where I remember having to explicily call the baseclass version of a function from the overriding method.
>
>I perused the documentation and then tried inserting 'NODEFAULT' into my method. This resulted in only one charater appearing per keystroke, but I the form lost its ability to handle tabs when that control has the Focus. Besides this, the focus no longer moves automatically when reaching the maximum number of characters for the control.
>
>What is the proper solution to my problem?
>
>Also, why did two '1's result when keypress was overridden, but NODEFAULT was not used?