(FILECREATED " 1-May-87 18:32:18" {QV}<NOTECARDS>1.3K>NEXT>RGPATCH037.;1 4087   

      changes to:  (VARS RGPATCH037COMS)
		   (FNS NC.AskUserResetWindow NC.AskUser))


(* Copyright (c) 1987 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT RGPATCH037COMS)

(RPAQQ RGPATCH037COMS ((* * rg 5/1/87 fixes bug that caused Exec window process to be set to NIL)
			 (* * changes to NCUTILITIES)
			 (FNS NC.AskUser NC.AskUserResetWindow)))
(* * rg 5/1/87 fixes bug that caused Exec window process to be set to NIL)

(* * changes to NCUTILITIES)

(DEFINEQ

(NC.AskUser
  [LAMBDA (Msg Prompt FirstTry ClearFirstFlg MainWindow DontCloseAtEndFlg DontClearAtEndFlg 
	       PROMPTFORWORDFlg)                             (* Randy.Gobbel " 1-May-87 18:29")
                                                             (* Get a response from the user -
							     using the promptwindow attached to MainWindow)

          (* * rht 9/16/84: Added DontClearAtEndFlg which if non-nil prevents the call to NC.ClearMsg.)



          (* * rht 5/22/85: Now uses TTYIN instead of PROMPTFORWORD so that people can edit their answer.)



          (* * rht 5/30/85: Added PROMPTFORWORDFlg so callers doing yes/no questions can get old style PROMPTFORWORD 
	  functionality.)



          (* * rht 8/6/85: Wrapped TTYIN with NLSETQ so wouldn't break if CR inadvertantly inserted in string.)



          (* * fgh 5/22/86 Added handling of COPYBYBKSYSBUF so that user can shift select into prompt windows being called 
	  from TEdit main windows.)



          (* * fgh 6/27/86 Added ERROR! is problems under TTYIN NLSETQ. Allows other process to kill the askuser process.)



          (* * rg 5/1/87 fixed problem that sometimes caused Exec window's process to get smashed)


    (LET (AskWindow TextObj)
         (RESETLST 

          (* * If MainWindow is a TEdit window, make sur we can shift select into the prompt window.)


		     (RESETSAVE (SETQ AskWindow (NC.PrintMsg MainWindow ClearFirstFlg Msg))
				  (BQUOTE (NC.AskUserResetWindow , AskWindow , MainWindow , 
								     DontClearAtEndFlg , 
								     DontCloseAtEndFlg)))
		     (RESETSAVE (TTY.PROCESS (THIS.PROCESS)))
		     [if (SETQ TextObj (WINDOWPROP MainWindow (QUOTE TEXTOBJ)))
			 then (RESETSAVE (TEXTPROP TextObj (QUOTE COPYBYBKSYSBUF)
							 T)
					     (BQUOTE (TEXTPROP , TextObj COPYBYBKSYSBUF ,
								   (TEXTPROP TextObj (QUOTE
										 COPYBYBKSYSBUF]

          (* * Go ahead and ask)


		     (PROG1 (if PROMPTFORWORDFlg
				  then (TTY.PROCESS (THIS.PROCESS))
					 (PROMPTFORWORD Prompt FirstTry 
						      "To type a ?, type CTRL-V followed by a ?."
							  AskWindow NIL NIL (CHARCODE (EOL)))
				else (RESETFORM (TTYDISPLAYSTREAM AskWindow)
						    (CAR (OR [NLSETQ
								   (TTYIN (MKLIST (OR Prompt "")
										      )
									    NIL NIL
									    (QUOTE (STRING NORAISE))
									    NIL NIL
									    (AND FirstTry
										   (LIST FirstTry]
								 (ERROR!])

(NC.AskUserResetWindow
  [LAMBDA (AskWindow MainWindow DontClearAtEndFlg DontCloseAtEndFlg)
                                                             (* Randy.Gobbel " 1-May-87 18:26")

          (* * called from RESETRESTORE to blow away prompt window, unless flags tell us not to)



          (* * rg 3/6/87 created)



          (* * rg 5/1/87 now check AskWindow non-nil so we don't accidentally smash the Exec window)



          (* * Setting the PromptWindow PROCESS to NIL is to break a circularity caused by TEXTOBJ -> PROMPTWINDOW -> PROCESS
	  -> TEXTSTREAM -> TEXTOBJ)


    (AND AskWindow (WINDOWPROP AskWindow (QUOTE PROCESS)
				   NIL))
    (OR DontClearAtEndFlg (NC.ClearMsg MainWindow (NULL DontCloseAtEndFlg])
)
(PUTPROPS RGPATCH037 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (572 4006 (NC.AskUser 582 . 3218) (NC.AskUserResetWindow 3220 . 4004)))))
STOP