_yesno.utl Utility - Ask a Yes/No Question
Syntax
call "_yesno.utl",question$,answer${,helpfile$,helpitem$,arguments$,
title$,input_attributes$,output_attributes$,timeout,control_value,
column,row,window_attributes$,box_attributes$,window,prompt_message$,
newline_character$,column_character$}
Description
The _yesno.utl utility prompts the user for input inside a windowed box. It only accepts a "Y" or "N" response, or an optionally allowed CANCEL.
If the (TRANSLATE) global string exists, the program attempts to translate "Yes" and "No" to the current (LANGUAGE) value using _tlate.utl.
Required Parameters
| 
                                                         Parameter  | 
                                                    
                                                         Description  | 
                                                
| 
                                                         question$  | 
                                                    
                                                         Prompt string.  | 
                                                
| 
                                                         answer  | 
                                                    
                                                         Reply to the question. Use 0 for "No" or 1 for "Yes".  | 
                                                
| 
                                                         helpfile$  | 
                                                    
                                                         Help information filename.  | 
                                                
| 
                                                         helpitem$  | 
                                                    
                                                         Help item if using _help.pub format.  | 
                                                
| 
                                                         arguments$  | 
                                                    
                                                         Uses the same argument list as _ninput.utl and the following arguments:  | 
                                                
| 
                                                         
  | 
                                                    
                                                         C CTLVAL=6 (Exit/Cancel) does NOT equal "No".  | 
                                                
| 
                                                         
  | 
                                                    
                                                         N Default answer is "No".  | 
                                                
| 
                                                         
  | 
                                                    
                                                         s No shadow.  | 
                                                
| 
                                                         
  | 
                                                    
                                                         S Leave in the window created and return the window number in the WINDOW parameter passed.  | 
                                                
| 
                                                         
  | 
                                                    
                                                         T Questions are translatable with _tlate.utl.  | 
                                                
| 
                                                         
  | 
                                                    
                                                         w Use the window passed in the WINDOW parameter.  | 
                                                
| 
                                                         
  | 
                                                    
                                                         Y Default answer is "Yes".  | 
                                                
| 
                                                         title$  | 
                                                    
                                                         Title for the windowed box. It can be placed centered in a box by starting it with a "@"; include "\" or the specified newline_character$ to force a line break.  | 
                                                
Note: The following attributes may be specified using any of the PRO/5 color and attribute mnemonics:
| 
                                                         Parameter  | 
                                                    
                                                         Description  | 
                                                
| 
                                                         input_attributes$  | 
                                                    
                                                         Input attributes (during data entry).  | 
                                                
| 
                                                         output_attributes$  | 
                                                    
                                                         Output attributes (during display).  | 
                                                
| 
                                                         timeout  | 
                                                    
                                                         Timeout (in integer seconds, (1 to 255), or 0 for no timeout). If a timeout occurs, the default answer (if defined) is returned.  | 
                                                
| 
                                                         control_value  | 
                                                    
                                                         Returned as a CTLVAL from the Input Subsystem. For a list of CTLVALs, see Key Maps.  | 
                                                
| 
                                                         column  | 
                                                    
                                                         Starting column for the window. -1 centers it in the current window.  | 
                                                
| 
                                                         row  | 
                                                    
                                                         Top row for this window. -1 centers it vertically in the current window.  | 
                                                
| 
                                                         window_attributes$  | 
                                                    
                                                         Attributes for the window.  | 
                                                
| 
                                                         box_attributes$  | 
                                                    
                                                         Attributes for the border of the window.  | 
                                                
| 
                                                         window  | 
                                                    
                                                         The window created is returned if the "S" argument is used. If the "w" argument is used, the window identifier is expected.  | 
                                                
| 
                                                         prompt_message$  | 
                                                    
                                                         Prompt string for the message window to override the default message.  | 
                                                
| 
                                                         newline_character$  | 
                                                    
                                                         Separates lines in the title. The default is "\" or the specified NEWLINE_CHAR$.  | 
                                                
| 
                                                         column_character$  | 
                                                    
                                                         Separates columns in the title.  | 
                                                
Example
LET BBEXT$=STBL("BBEXT")
LET QUESTION$="OK to print report now? "
CALL BBEXT$+"_yesno.utl",QUESTION$,OK,$$,$$,"Y"
IF OK THEN GOSUB PRINT_REPORT
This creates the following prompt window.
If set, the default value is always indicated to the user as [YES] or [NO]. Otherwise, the prompt shows [Y/N].
The only acceptable input responses are:
<RETURN> to accept the default value.
"N" to select NO.
"Y" to select YES.
Press <CANCEL> to indicate a negative response (NO). However, if a "C" argument was passed, the operation aborts without returning a value.
The following example displays a multiline window that accepts an abort of the operation and defaults to NO if a timeout occurs:
LET NEWLINE$=STBL("NEWLINE_CHAR")
LET BBEXT$=STBL("BBEXT")
QUESTION$="Begin Update Process Now? "
ANSWER=0
IF WINDOW THEN LET ARGS$="CNS" ELSE LET ARGS$="CNW"
TITLE$="@Important Break Point! "+
:NEWLINE$+"Be Sure You Are Ready"
TIMEOUT=30
PCOL=-1
PROW=-1
CALL BBEXT$+"_yesno.utl",QUESTION$,ANSWER,$$,$$,
:ARGS$,TITLE$,$$,$$,TIMEOUT,CTLVAL,PCOL,PROW
IF CTLVAL=6 THEN GOTO ABORT_RECEIVED
IF ANSWER=0 THEN GOTO SET_UPDATE_PARAMETERS