Hi Everyone,
This propbably a simple question to answer, but I cannot find how to do this and have spent some time with this problem:
1. I use openwindow command
2. have a text box for the user to enter a password
3. A second text box to confirm the password
How do I detect the user has pressed the 'Enter' key ?
Sorry if this is such a basic question - can anyone help with a little example ?
Thank You all so much,
Andy.
If the edit control is a single line control, the system will detect when the enter key has been pressed, and will press the current window/dialog default button. You can specify the window/dialog default button by using the @CTLBTNDEFAULT flag with the control creation function for the button.
From the User Guide:
@ENTABKEY
The user has pressed the TAB key while the control has input focus. Only sent if enabled by the SETCONTROLNOTIFY command.
@ENENTERKEY
The user has pressed the ENTER key while the control has input focus. Only sent if enabled by the SETCONTROLNOTIFY command.
Example from the EB sample files:
WINDOW win
OPENWINDOW win,0,0,295,199,0,0,"Caption",&handler
CONTROL win,@EDIT,"Press Enter or TAB",83,39,124,27,0x50800000|@CTEDITAUTOH,5
SETFONT win,"Ariel",9,400,0,5
SETCONTROLNOTIFY(win,5,1,1)
SetFocus win,5
WAITUNTIL win=0
END
SUB handler
SELECT @MESSAGE
CASE @IDCONTROL
IF @CONTROLID = 5
SELECT @NOTIFYCODE
CASE @ENENTERKEY
MESSAGEBOX win,GetControlText(win,5),"Enter Pressed!"
SetFocus win,5
CASE @ENTABKEY
MESSAGEBOX win,"Tab key pressed","Info"
SetFocus win,5
ENDSELECT
ENDIF
CASE @IDCREATE
CENTERWINDOW win
CASE @IDCLOSEWINDOW
CLOSEWINDOW win
ENDSELECT
RETURN
ENDSUB
Thanks everyone!
I will give it go and once again thanks!
Andy