How to detect control, alt or meta key pressed

How to detect control, alt or meta key pressed

Post by horng ming t » Wed, 28 Dec 1994 02:15:50



Hi!
        I have developped an text editor on PC. Now I would like to port it to UNIX.
        However, I have some problems to detect control, alt or meta key pressed.
        Does anyone know how to do this on text terminal? TKS.


 
 
 

How to detect control, alt or meta key pressed

Post by Highlander C H B » Wed, 28 Dec 1994 11:13:12



: Hi!
:       I have developped an text editor on PC. Now I would like to port it to UNIX.
:       However, I have some problems to detect control, alt or meta key pressed.
:       Does anyone know how to do this on text terminal? TKS.

        With curses you can do it . There is a function named unctrl( char )
that returns the ctrl character in ^X notation.Of course you'll have to be
on a 8bit term to use this.See man curses or ncurses for more detail.

                                Happy New Year



 
 
 

How to detect control, alt or meta key pressed

Post by Kevin Kad » Wed, 28 Dec 1994 10:18:22




Quote:>Hi!
>I have developped an text editor on PC. Now I would like to port it to UNIX.
>However, I have some problems to detect control, alt or meta key pressed.
>Does anyone know how to do this on text terminal? TKS.

The short answer is you can't detect ctrl/alt/shift from the user's terminal,
because no ASCII code is sent unless they press a normal key.

There _are_ ways to do this with 'doorway' mode on IBM PC terminal programs, but
your better off designing the program to respond to sequences like CTRL-B rather
than depending on beling able to detect the CTRL key alone.

Plus, if you stick to the "standard" Wordstar(tm) sequences, such as CTRL-Y to
delete a line, etc, then people will be able to use your editor without
learning a whole new set of commands.
--

FREE Usenet/Mail, inexpensive Internet - Ripco... Wearing white hats since 1983
Dialup:(312) 665-0065|Gopher:gopher.ripco.com|Telnet:foley.ripco.com ('info')

 
 
 

1. Alt Key, Meta Key on Solaris 5.7 X terminal?

Hi, All:

I access the Solaris 5.7 server as x terminal. However, I can not use
the Alt key and Meta key.

I tried to use xmodmap to map the key.

I also put a .Xmodmap file in my home directory for .xinitrc.
The file contents are:

clear mod1
clear mod4
add mod1 = Alt_L
add mod4 = Meta_L Meta_R
keysym Alt_L = Alt_L Meta_L
keysym Alt_R = Alt_R Meta_R

And the results when I run "xmodmap -pke" are:

keycode   9 =
keycode  10 =
keycode  11 =
keycode  12 =
keycode  13 = Shift_R Shift_R
keycode  14 = Control_R Control_R
keycode  15 = Alt_R Meta_R
keycode  16 = BackSpace Delete
keycode  17 = Tab Tab
keycode  18 = Alt_L Meta_L
keycode  19 =
keycode  20 = Clear Clear
keycode  21 = Return
keycode  22 =
keycode  23 =
keycode  24 = Shift_L Shift_L
keycode  25 = Control_L Control_L
keycode  26 = Menu Menu
keycode  27 = Pause Pause
keycode  28 = Caps_Lock Caps_Lock
keycode  29 = KP_F1 KP_F1
keycode  30 =
keycode  31 =
... ... ...

But the problem is there is no Alt_L Alt_R key. So the association Meta
key to Alt key definitely not
successful.

Any one has good suggestion for fixing my Alt Key problem?

Zhou

2. Mouse + KDE

3. ALT key, Meta Key on Solaris 5.7 Xterminal

4. flushing stdin in /bin/sh?

5. Using <ALT> as META-key in TCSH.

6. Smartlink 5634PCV Internal PCI Modem

7. ALT (or META) key doesn't work in syscons.

8. cgi-bin and www directories

9. meta/alt key doesn't work from remotely launched emacs

10. META - ALT key help please

11. Test for [Alt] / Meta key ?

12. Panic: I've lost my Alt/Meta Key!

13. Alt/Meta keys under emacs