>You should be fine using TextBox::KeyPress( nKeyCode, nShift ), Using DoDefault() if you are deriving from another TextBox subclass that does not have code in it's KeyPress() method you'll see the doubled up characters. I call it a bug, but not everyone agrees. *shrug*
I have already tried this method, but it hasn't worked correctly. Some previous behavior was lost, such as the ability to use the tab key to change controls. What I am working on is actually someone elses control, and the only change I made was the change I mentioned.
Here is part of the text to my original message
>>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.
David Moreau