(FILECREATED " 9-JUN-83 14:59:10" {INDIGO}<LOOPS>TRUCKIN>INMENU.;2 3374 previous date: " 8-JUN-83 18:11:05" {INDIGO}<KBVLSI>TRUCKIN>INMENU.;1) (PRETTYCOMPRINT INMENUCOMS) (RPAQQ INMENUCOMS ((* Copyright (c) 1983 by Xerox Corporation.) (* INMENU package. Functions to support interactive menus for program interaction. Similar to the standard pop-up menus except that arguments are compatible with INTTY and does not lock out other processes.) (* Written by Mark Stefik.) (FNS INMENU InMenuWhenSelectedFn))) (* Copyright (c) 1983 by Xerox Corporation.) (* INMENU package. Functions to support interactive menus for program interaction. Similar to the standard pop-up menus except that arguments are compatible with INTTY and does not lock out other processes.) (* Written by Mark Stefik.) (DEFINEQ (INMENU [LAMBDA (promptStr goodList helpStr noShiftFlg) (* mjs: "18-FEB-83 10:05") (* INMENU returns an atom selected by a user from a menu. If the user selects ?, the helpStr is printed. The arguments to INMENU are intended to be compatible with INTTY. The last argument, noShiftFlg, is not used.) (COND ((NULL goodList) (* Default to INTTY if no goodList) (INTTY promptStr goodList helpStr noShiftFlg)) (T (PROG [menu window items item xPos yPos (dismissTime 300) (NotSet (CONSTANT (QUOTE **NotSetYet**))) (bellFlash (CONSTANT (CHARACTER 7))) (pointers (CONSTANT " Use menu --->>")) (questionMark (CONSTANT (QUOTE ?] (SETQ items (COND (helpStr (NCONC1 (COPY goodList) questionMark)) (T goodList))) (SETQ menu (create MENU ITEMS ← items WHENSELECTEDFN ←(FUNCTION InMenuWhenSelectedFn) TITLE ← promptStr MENUOUTLINESIZE ← 2)) [SETQ xPos (PLUS (DSPXOFFSET NIL PROMPTWINDOW) (fetch WIDTH of (DSPCLIPPINGREGION NIL PROMPTWINDOW] (SETQ yPos (IDIFFERENCE [IPLUS (DSPYOFFSET NIL PROMPTWINDOW) (fetch HEIGHT of (WINDOWPROP PROMPTWINDOW (QUOTE REGION] (fetch IMAGEHEIGHT of menu))) (ADDMENU menu NIL (create POSITION XCOORD ← xPos YCOORD ← yPos)) (SETQ window (WFROMMENU menu)) (WINDOWPROP window (QUOTE MenuValue) NotSet) (PROMPT (CONCAT bellFlash promptStr pointers)) WaitLoop (while [EQ NotSet (SETQ item (WINDOWPROP window (QUOTE MenuValue] do (* Wait for selection to be made.) (DISMISS dismissTime) (TOTOPW window)) (COND ((EQ item questionMark) (PROMPT helpStr) (WINDOWPROP window (QUOTE MenuValue) NotSet) (GO WaitLoop))) (DELETEMENU menu T) (PROMPT) (RETURN item]) (InMenuWhenSelectedFn [LAMBDA (item menu key) (* mjs: "16-FEB-83 11:31") (* This WHENSELECTEDFN saves the item selected in a window property where INMENU will find it.) (PROG (window) (SETQ window (WFROMMENU menu)) (WINDOWPROP window (QUOTE MenuValue) item) (RETURN item]) ) (DECLARE: DONTCOPY (FILEMAP (NIL (876 3352 (INMENU 886 . 2907) (InMenuWhenSelectedFn 2909 . 3350))))) STOP