Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keypress problems
Message
De
14/12/1998 05:22:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00167079
Message ID:
00167110
Vues:
27
>In a Keypress method of a form I have a case statement like the following (snippet)...
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>DO CASE
>CASE nKeyCode = 19 AND nShiftAltCtrl = 2
>ThisForm.cmdSave.Click()
>NODEFAULT
>CASE nKeyCode = 21 AND nShiftAltCtrl = 2
>ThisForm.cmdUndo.Click()
>NODEFAULT
>.
>.
>.
>OTHERWISE
>DODEFAULT()
>ENDCASE
>
>... which works fine for the keys in the case statement, like Ctrl S for save. However, with this code in use I have two problems:
>
>1. Pressing Tab skips over fields on the form, like every other one. The tab order is set correctly. When I Shift Tab it moves through every field. If I comment out the Keypress code Tab moves through the form perfectly.
>
>2. While tabbing through the fields (skipping like above) I hit an error "Property Value is not found." on some of the combo boxes on the form. The combo boxes are pretty standard, with no unusual code in their methods. Again, if I comment out the Keypress code this error does not appear.
>
>Any ideas on what is going on with this Keypress method? I do not have any code in the Keypress specific to the Tab key.
>
>Thanks.

Hi Mark,

I was just composing a reply when I noticed Christof appeared with much the same information. But since I have it mostly done, here it is ...

VFP has a problem with DODEFAULT() in keypress events. They make the key fire two times. This is the reason for your tabs that skip, and other odd behavior. MS has claimed to fix this bug at least 2 times since VFP 3, but it's still around.

You won't have the problem if you just omit DODEFAULT() from you code, or if you need to trigger superordinate class cose, use the mybaseclass::keypress construct.

good luck
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform