Re: using function key
Posted in 1998
Hi,
jjdai07@my-dejanews.com wrote:
>
> Hi ,
>
> I use informix-4gl Ver 4.10 on hp-ux , How can I mask the ctrl-c (interrupt)
> key , How can I define F9 as accept key , and F7 as cancel key , F11 as exit
> key , Bty , I use anzio terminal software , my terminal is wy50 , my terminfo
> file is $INFORMIXDIR/etc/terminfo .
>
Possibly there is s.o. out there who has a better idea ... please
let me know.
First, my translation how I understand your question, then my
suggestion:
* You don't want to exit the program if the user enters "ctrl-c" !?!
-> Map the interrupt key to another key, like ctrl-# ( visible ^^ )
Enter at the command line:
$ stty intr "^^"
$ startyourapplication
You want an interrupt to be send to your program if the user
hits the function key F7 !?!
* Read your terminal description whether it's possible to program
your function keys.
-> Define the characters to be send to the computer as "ctrl-#".
Your stty-driver will map this key to the interruot key, now.
* You want the function key F9 to work as accept key !?!
-> OPTIONS
ACCEPT KEY F9
If your 4GL application will not understand the F9 key, you
must define this key in your termcap entry. ( I think Informix
does not support the terminfo on HP-UX ). Therfore the termcap
should be used. If you have no idea of what your terminal sends
to your computer when you press the F9 key, you can find it
out very easy:
$ od -c press the F9 key several times, then enter a newline and <ctrl-d>
The od-command will display the bytes sent to your box.
The output is shown either in visible characters, or in
octal representation. ( 033 means Escape, in your termcap
entry you will find the \\E character. If the display looks
like:
033 [ 2 0 ~ 033 [ 2 0
this stands for the termcap value
\\033[20~
The appropriate entry would look like this:
:k8=\\E[20~:
I know that the original termcap makes a difference between
the number of function keys defined in the entry. If you have
more than 10 function keys F1 to F20, then the first function
key would start either at "k0" or "k1". But I can't remember in which
case it should start with "k0" and when it would start with "k1".
I think you will find it out when you defined "k2".
Far as I know, there is a command to convert a terminfo entry
to an old termcap entry. On HP-UX I think there is no "captoinfo"
command. On HP-UX 10.20 I guess there is the "infocmp"
command available and the conversion option should be -C,
infocmp -C
will generate the termcap entry that should work for your
terminal. Possibly it contains the function keys as well.
* Finally, how can you define an exit key !?!
-> I think this should be done by the programmer.
INPUT .....
AFTER INPUT
LET status = TRUE
ON KEY( F11 )
LET status = FALSE
EXIT INPUT
END INPUT
...
LET status = TRUE
PROMPT "Enter a number" FOR number_i
ON KEY( F11 )
LET status = FALSE
END PROMPT
...
Hope this might help.
Bye
Stefan Weideneder