From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,7ff8cab7a19e4f98 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-07-15 12:23:17 PST Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!darwin.sura.net!news-feed-1.peachnet.edu!umn.edu!lynx.unm.edu!ug.eds.com!kirscht From: kirscht@ug.eds.com (Korben R. Kirscht) Newsgroups: comp.sys.dec Subject: Re: Curses problem Date: 15 Jul 93 12:11:50 GMT Organization: EDS Unigraphics, Cypress CA Message-ID: <1993Jul15.121150.1@ug.eds.com> References: NNTP-Posting-Host: vxs1.ug.eds.com In article , john@iastate.edu (John Hascall) writes: > david_s@iastate.edu (David P Sly) writes: > } I am trying to compile a curses program on DEC3100 (Ultrix 4.2), > }using cursesX. The screen comes up fine. But the trouble starts when I > }try to use the funtion keys. I just return the key code of the key > }pressed and when 'q' is pressed I quit. It works for all alphanumeric keys. > }But on pressing, say F1 (KEY_F(1)) I don't get the value 411 ( form the > }header file for curses). > } > } Can somebody shed light on what I am doing wrong ( or what could be > }wrong). > > I believe that `curses F1' is what is labeled `PF1' on the DEC > keyboard -- I don't think curses knows the escape sequences > for the F# keys across the top of the keyboard (you'll have to > decode them yourself). > /* Program : read_keystrokes.c Author : Korben Kirscht Site : EDS / Unigraphics, Cypress, CA Date : 24-April-1993 Since the curses keyboard functions do not pass special keys correctly on VMS, one must use the SMG Virtual Keyboard routines for getting characters from the keyboard. This program was designed to test the keyboard and print the integer value passed back by the keyboard routines. This integer value may then be associated with a defined value and comparisons may be made within your application. (ie. if (keystroke == UP_ARROW) ) Within my application programs I make these definitions in a header file named "keydefs.h". (see example below) */ #include #include #define bool int main () { WINDOW *win1; int keyboard, /* Pointer to keyboard */ status; /* General status field for checking return values */ short keystroke; /* Holds key entered on the keyboard */ /* Create the virtual keyboard and return the pointer to the keyboard into keyboard variable. */ if ( ((status = SMG$CREATE_VIRTUAL_KEYBOARD(&keyboard))&1) !=1 ) return; /* Create a basic window. Nothing is displayed on the window however */ initscr(); win1 = newwin(15, 10, 5, 5); wrefresh(win1); refresh(); /* Read a keystroke from the virtual keyboard */ SMG$READ_KEYSTROKE(&keyboard,&keystroke); /* Within your *REAL* application, you may test the keystroke against defined values from "keydefs.h". Example: if ( keystroke == UP_ARROW ) ... */ endwin(); /* Print the printable translation of the keystroke and the integer value returned from the SMG routine. The integer value is used in "keydefs.h" */ fprintf(stdout, "\n%c(%d)", keystroke, keystroke ); } /* keydefs.h Defines Integer from SMG$SMG$READ_KEYSTROKE ... Stuff deleted ... #define BACKSPACE 8 #define UP_ARROW 274 #define DOWN_ARROW 275 #define LEFT_ARROW 276 #define RIGHT_ARROW 277 #define RETURN 13 #define ESCAPE 291 #define TAB 9 #define CTRLW 23 ... Stuff deleted ... */ -------------------------------------------------------------------------------- Korben Kirscht | EEEEEE DDDDDD SSSSS UU UU GGGGGG EDS Unigraphics | EE DD DD SS // UU UU GG 10824 Hope Street MS: 1S-135 | EE DD DD SS // UU UU GG Cypress, CA 90630-5099 | EEEE DD DD SSSS // UU UU GG | EE DD DD SS // UU UU GG GG Internet: kirscht@ug.eds.com | EE DD DD SS // UU UU GG G | EEEEEE DDDDDD SSSSS UUUUU GGGGGG