home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.hp:14800 comp.lang.c:19608
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscit.sc.hp.com!hpdstma!dave
- From: dave@hpdstma.ptp.hp.com (Dave Waller)
- Newsgroups: comp.sys.hp,comp.lang.c
- Subject: Re: capturing a keystroke
- Date: 13 Jan 1993 00:33:08 GMT
- Organization: Hewlett Packard
- Lines: 51
- Sender: dave@hpdstma (Dave Waller)
- Distribution: world
- Message-ID: <1ivo04INNhr8@hpscit.sc.hp.com>
- References: <1993Jan7.145947.9534@iccgcc.decnet.ab.com>
- NNTP-Posting-Host: hpdstma.ptp.hp.com
-
- In article <1993Jan7.145947.9534@iccgcc.decnet.ab.com>, weisfeld@iccgcc.decnet.ab.com writes:
- |> Everything is working fine, except for the arrow keys. When I enter a
- |> single character (say an 'R'), I get the expected character code. However,
- |> when I enter an arrow key, the cursor simply moves on the screen and no
- |> character code is returned. The HP manual states that in LOCAL MODE
- |> the system displays control codes but does not execute them. It states that,
- |> if you press the left arrow key, the terminal displays an escape character
- |> on the screen but does not perform the cursor left function. I put the
- |> machine in LOCAL MODE and the cursor still moves.
-
- This is the normal operation of HP terminals and terminal emulators. What you
- need to do is turn on the transmit functions capability of the terminal or
- terminal emulator, which can be done is a variety of ways.
-
- One way is to simply output the escape sequence that turns this capability
- on with a printf() call as follows:
-
- printf("\033&s1A");
-
- This will enable the transmission of escape codes representing each of the
- special keys (arrows, home, insert char, f1, f2, etc etc etc). The general
- form of this escape sequence is
-
- \033&snA
-
- where "n" is either 1 or 0, turning the transmit functions feature on or
- off respectively.
-
- However, this method suffers from poor portability, and therefore is not
- a desirable way to accomplish this task. This escape code could have very
- undesirable consequences on a competitor's terminal.
-
- A more portable way to turn on these keys is to use the curses library
- function keypad(), which will basically cause the same excape sequence to
- be sent on an HP machine, but will be portable to other platforms generating
- the correct escape sequences for the particular vendor.
-
- A detailed discussion of HP escape codes can be found in the HP manual,
-
- Terminal Control: Users Guide
- p/n B1862-90013
-
- with a complete listing of the excape codes in appendix C.
-
- Hope this helps!
-
- --
- Dave Waller
- Hewlett-Packard Co.
- Workstation Systems Division
- Sunnyvale Channel Partner Consulting
-