Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using "ON KEY" to close a BROWSE window in IV 2.0 1

Status
Not open for further replies.

jgood4u

Programmer
Feb 13, 2003
4
0
0
US
dBASE IV 2.0 has an ON KEY LABEL ctrl-m DO <proceedure> command that will perform the proceedure when the &quot;Enter&quot; key is pressed. Using this construct, I open a window and use the BROWSE command to allow a user to select a record. The user must be able to view multiple fields to correctly select the desired record so using an ON SELECTION POPUP construct won't work.

All works well in having the user select the chosen record bypressing the Enter key except that I am unable to close the BROWSE function without the brogram flow returning to the browse window and then having the user press the escape key - a confusing process for the user who just selected the record they wanted with the Enter key. Everything in the dBASE documentation indicates that program flow control should return to the instruction following the BROWSE command upon RETURN from the ON KEY proceedure. Does any one know how to close a BROWSE window from within a proceedure or another way I can accomplish this seemingly simple task?

Thanks,
John
 
I'm not sure if this will work, but try placing the command line:

KEYBOARD '{CTRL+W}'
or
KEYBOARD '{ESC}'

at the end of your procedure that's called by ON KEY.
 
With some minor syntax adjustments, this seems to do the trick, THANKS!

For the benefit of others who might use this, KEYBOARD doesn't take '{ESC}' (or Enter, either), but works with CHR(27):

KEYBOARD CHR(27)
or
KEYBOARD '{CTRL-W}'

[note the minus (-), not plus (+) sign]

Also of interest is that this code does not work in the debug mode when stepping thru the code line by line. Apprently the type-ahead buffer gets the &quot;S&quot; step key confused with the ESC inserted by the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top