_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 |
|
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 |
|
|
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
|
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:
|