Information générale
Titre:
Edit box class - user press enter - leave box
Versions des environnements
Network:
Windows 2003 Server
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement