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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fuction Keys to activate Control-End

Status
Not open for further replies.

bigroger

Programmer
Jun 2, 2003
9
0
0
AU
I have used several commercial 4GL programs (Progress and Pronto) that have the ability to globally accept and process by pressing F1 (Progress) or F4 (Pronto).
I think this is equivalent to "Control-End" in dbase.
I cannot work out how to do this - say make F4 key in dbase = Control-End.

By the way I am still programming and using compiled applications in dbase 4 and have no problems running up to Windows 2000. I am yet to try XP fully but i think it will be OK.
 
You will have to use the ON KEY command

ON KEY LABEL F4 DO MyProg

<other code>

PROCEDURE MyProg

KEYBOARD ASC(23) && the ascii value for CTRL-END



 
Try using CHR(23) since the ASC() function gets the ASCII value of the first character of a string.

Also, this seems to work within programs in dBase 5 for DOS so it probably works in your version too:

ON KEY LABEL F4 KEYBOARD CHR(23)

To remove it simply use this line:

ON KEY LABEL F4

Note: The above works INSIDE running programs but not necessarily at the dBase command prompt where your ON KEY LABEL assignments are overridden by the dBase defaults.

The code (23) is for either ctrl-W or ctrl-End, by the way, but don't bother trying to explain to those users who don't know about the left-hand-only keypress combination or some of the users will get confused. Anyway, you want them to use F4, right?

dbMark
 
dBMark: I am not sure about dbase, but in foxpro 2.??
you can do

set function f4 to chr(23)
or any other String, chars, etc.
Tryit.
 
Thanks to all - works fine!

What about a chr code for "control-home" ?

regards

roger
Australia
 
If you need to know more than just one or two codes, then you ought to have a program designed to fetch those values. Otherwise, there would be delays in answering each specific request as you come across the need.
Code:
* GET LAST KEYPRESS
PRIVATE cExc
cEsc=SET("ESCAPE")
SET ESCAPE OFF  && turn off language-level Esc detection
DO WHILE .T.
   ? "Last key press: "+LTRIM(STR(LASTKEY()))
   IF LASTKEY()=27
      EXIT
   ELSE
      WAIT
   ENDIF
ENDDO
SET ESCAPE &cEsc
RETURN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top