fin@norge.unet.umn.edu (Craig A. Finseth) (06/27/90)
In article <31210033@hpcvia.CV.HP.COM> scottb@hpcvia.CV.HP.COM (Scott_Burke) writes:
It IS possible to display a menu without halting or terminating a
program with a HALT or KILL statement.
It is done by creating a menu list of 6 objects and then using the
TMENU or MENU command. This prepares the list for display.
The next step is presumable an input loop, waiting for key presses.
This is done with a -1 WAIT statement, which WILL display the menu
while it waits for a keypress. Note that 0 WAIT performs the
identical function but does NOT display the menu.
I found this in the manual and spent hours trying to get it to work.
It appears that the displayed menus are not updated until after the
program exits back to command level. Could you post your working
code? Please??
Note also that the WAIT statement traps ALL key presses except ATTN.
if ATTN is pressed, and the LASTARGS flag is clear, 0 or -1 will be
...
Good. We were trying to figure out how to do this.
Craig A. Finseth fin@unet.umn.edu [CAF13]
University Networking Services +1 612 624 3375 desk
University of Minnesota +1 612 626 1002 FAX
130 Lind Hall, 207 Church St SE, Minneapolis MN 55455-0134, U.S.A.
scottb@hpcvia.CV.HP.COM (Scott_Burke) (06/29/90)
Okay, here is a test-menu program that displays what I mentioned in a previous note. It is a polite program, in that it preserves user flags and the last menu displayed before it was executed; these are standard techniques if you don't want to muck up the user's settings every time he/she uses your code. You can take it a step further and preserve the stack, but since this code doesn't really do too much on the stack, I haven't worried about it. The program displays a message and a menu, and then waits for one key- press. It returns which key was pressed, in the form rc.p, where r is row, c is column, and p is plane (1 - not shifted, 2 - left-shifted, etc.) It traps the ATTN key, and returns 91.1 for that key. The listing is just typed in, and is not downloadable. << RCLF RCLMENU -> lastflags lastmenu @ save flags and menu << -55 SF @ no LASTARGS; see note 1 { "A" "B" "C" "D" "E" "F" } TMENU @ build temp menu list CLLCD @ clear screen "TEST-MENU PROGRAM" 3 DISP @ display program msg. ERR0 @ clear ERRN,ERRM; note 2 IFERR -1 WAIT @ get keypress, show menu THEN IF ERRN # 0d == @ if it was an ATTN press, THEN 91.1 @ return the key location ELSE ERRN DOERR @ else propagate the error END END lastmenu MENU lastflags STOF @ restore flags and menu >> >> note 1: -1 WAIT leaves -1 on the stack if LASTARGS (flag -55) is clear default is clear, because LASTARGS can be useful; however, it is a pain in this situation, because you would have to check if ERRN==0 and then DROP the -1. note 2: ERRN and ERRM contain the last error number and message, but if the error/abort signal is an ATTN press, it does NOT change ERRN and ERRM, but leaves them set to whatever the last error was. Therefore, if you clear them, you know you got an ATTN if ERRN is #0d.