Re: Help Needed with fgl_lastkey
Posted in 1996
Matt or Dave: I've got a c function which is used in the Power-4gl toolkit (see bottom). I have no idea where it came from originally or how it works, but a colleague supplied it to me a long time ago and it has always performed very well: /******************************************************************************\\ Return an integer code for a keyboard key. \\******************************************************************************/ extern short eflastkey; fgl_getkey(nargs) int nargs; { extern short _acckey; short keyhit; eflastkey = ((keyhit = rgetkey()) == _acckey) ? 2016 : keyhit; clrmsg(); retlong((long) eflastkey); return(1); } This function replaces the prompt statement and the fgl_lastkey call in your example below. Dave Brush wrote: > I need help with a function to show me the last keystroke made (for > use in vertical menu's etc) > I've got a function which looks something like this > FUNCTION ..... > DEFINE .... > PROMPT "" FOR CHAR lc_char > ON KEY(LEFT,RIGHT, UP, DOWN, PREVPAGE . . . . . . etc > LET ln_key_no = fgl_lastkey() > END PROMPT > .... > This works fine except for the right cursor key, which isn't detected > until the visible display is cursored through. > I cannot use a hidden field in a form as this is a "generic" function > when various windows/forms may be open (hence the use of prompt) > If possible a 4gl solution is required, or a c routine that will do > the same thing > many thanks > matt ---------------------------------------------------------------------- John H. Frantz Power-4gl: Extending Informix-4gl frantz@centrum.is http://www.strengur.is/~frantz/pow4gl.html