Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Intercepting keystrokes
Message
 
 
To
05/06/1998 20:02:34
David Moreau
Iglesia Ni Cristo - Dnm
Quezon, Philippines
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00105416
Message ID:
00105537
Views:
67
David,

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*

If you go to my website and look at the code in the Quicken-like txtDate class I posted there you'll see how I handle it.

>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?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform