Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Intercepting keystrokes
Message
 
À
05/06/1998 20:02:34
David Moreau
Iglesia Ni Cristo - Dnm
Quezon, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00105416
Message ID:
00105427
Vues:
57
Instead of KeyPress, try using InteractiveChange.
do case
case up-arrow
    up-arrow stuff

case down-arrow
   down-arrow stuff

otherwise
   dodefault()  && Use the :: structure here for VFP3
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?
Barbara Paltiel, Paltiel Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform