Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
KeyPress method - skip the class code
Message
 
 
To
01/05/2019 08:15:12
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01668315
Message ID:
01668330
Views:
78
>>Hi everybody,
>>
>>I have a form's class with KeyPress method code. I have a form based on that form's class where I don't want to execute parent's class method. I added NODEFAULT in the KeyPress event and found that pressing keys in that form didn't do anything (e.g. input controls stopped operations).
>>
>>So, how can I have normal operation of KeyPress but prevent class method's to execute?
>>
>
>Just put a comment in the method, or since we're talking KeyPress, set KeyPreview to .F.
>
>That said, I'd argue that if you built the behavior into the form class and don't want it in a particular form, either that form should be subclassed from another class or you should wrap that capability in a logical property, so you can turn it on and off for individual form subclasses. (And yes, you could use KeyPreview that way here, but there's a more general principal at stake.)
>
>Tamar

I needed to add functionality to the existing form which was already built using a particular class (that class had some default Search behavior built in based on KeyPress event). I found incorrect behavior of the form so I originally just added nodefault. I later found that input controls stopped working, so I just added one line into KeyPress and it worked (e.g. the parent's behavior was not executing but the default KeyPress worked).

Thanks.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform