Re: HELP: arrow keys and INPUT
Posted in 1994
In article <2t4nfv$bed@david.wheaton.edu>, Todd A Bernhardt wrote: > action. The problem here is that PROMPT will not read arrow keys and I > can not figure out how to map the arrow keys so I can use them within a > PROMPT. I can use CONTROL-P and CONTROL-N, but I would much prefer to > use the arrow keys. Here's a method of checking for arrow keys (and anything else), based on the function fgl_lastkey(): ------- cut here -------- main define x, i smallint, k array[1] of char, l_keyval char(5) open form test from "menua" display form test let k[1] = "p" options input no wrap, insert key f36, # Turn off insert/delete/next/previous delete key f36, # Hey Informix: Wish I could say next key f36, # "insert key none" - I hope I never find previous key f36, # a user capable of finding F36! message line last while (k[1] != 'x' or k[1] is null) input array k from key.* attribute(invisible) after field ks exit input on key(f1) exit input on key(f2) # Duplicate these two lines exit input # thru F36 end input # Get the value of the last keypress... LET i = fgl_lastkey() IF k[1] IS NULL THEN # Then it must be a special character... CASE i # so do the translation... WHEN 2000 LET l_keyval = "UP" WHEN 2002 LET l_keyval = "LEFT" WHEN 2018 LET l_keyval = "RIGHT" WHEN 2016 LET l_keyval = "DOWN" # (This is just a guess - might be wrong) WHEN 3000 LET l_keyval = "F1" WHEN 3001 LET l_keyval = "F2" # (expand thru F36 - if you're keen) END CASE ELSE LET l_keyval = k[1] END IF message k[1],":",i," ", l_keyval,"" end while end main ------- cut here -------- database formonly screen { [a] } attributes a = formonly.ks, AUTONEXT; instructions delimiters " " screen record key[1](ks); ------- cut here --------