Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Edit box class - user press enter - leave box
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01233227
Message ID:
01233239
Vues:
9
And just to add - you may move your UPPER case logic into this method as well instead of InteractiveChange, e.g.
IF between(m.nKeyCode, 97, 122) && a - z
   NODEFAULT
   nKeyCode= m.nKeyCode - 32 && a -> A
   DODEFAULT(m.nKeyCode, m.nShiftAltCtrl)
ENDIF
They key point is to have NODEFAULT in the code.

>>I am working on a new edit box class
>>It has 2 new properties:
>>1. lUpperCase - if true act as if the format is ! in text boxes... (Format='K' is the only one that works in an edit box according to help.)
>>Then in the Interactive Change event I place the following code
>>IF this.lUpperCase
>> this.Value=UPPER(this.Value)
>>ENDIF
>>
>>This seems to work ok
>>
>>Now I would also like to give the ability to hit Enter to move to the next field. Thus the second properrty lExitOnEnter
>>So to that end, In the KeyPress event I've added:
>>LPARAMETERS nKeyCode, nShiftAltCtrl
>>IF this.lExitOnEnter
>> IF nKeyCode=13
>> KEYBOARD '{TAB}'
>> ELSE
>> DODEFAULT(nKeyCode,nShiftAltCtrl)
>> ENDIF
>>ELSE
>> DODEFAULT(nKeyCode,nShiftAltCtrl)
>>ENDIF
>>
>>This has the desired effect but also has two undesired effects, one major and one minor...
>>
>>Minor one... When enter is pressed, the edit box enters the line, the cursor drops down a line in the edit box prior to moving out, and then moves out of the box as intended. Thus it is not necessarily obvious that it worked.
>>
>>Major one... Repeated characters i.e. Holding a key down causes repeated characters, as fast as you can type. I tried it with the word TEST. and I got TTEEEESSTTT as the entered value. And I was just typing normally...
>>
>>How do I get arround this one?
>>
>>TIA,
>>Mike
>
>
>Try:
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>IF nKeyCode=13 AND this.lExitOnEnter
>   NODEFAULT
>   KEYBOARD '{TAB}'
>ENDIF
>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform