ask.enum()
Syntax
domain ask.enum( string quescode(14), domain default_enumval [, arg ] ... )
Description
This displays a message box containing a question and a number of possible responses. The responses are presented as push buttons. To respond to the question and close the message box, the user selects one of the push buttons.
The possible responses are defined in the data dictionary as an enumerated domain. By default, the function displays all of the defined enumerate values. To display a subset only, call set.ask.enum.values() before calling ask.enum().
Arguments
|
quescode
|
The question to be displayed in the message box is defined in the data dictionary. This argument specifies the data dictionary code for the question.
If the question contains substitution symbols, use the third and subsequent arguments to specify the values to substitute for these symbols.
|
|
default_enumval
|
Specifies the enumerate value of the default answer. For example, tcyesno.yes. If this argument is empty, the default value specified in the data dictionary is used.
|
|
arg, …
|
The values to substitute for any substitution symbols that the question contains. See sprintf().
|
Notes
The question text and the push button labels are always in the language of the user. The return value of ask.enum() is always the enumerate value and not its description. So the script in which the function is used remains language independent.
Return values
The value of the enumerated domain that corresponds to the option selected by the user. This is always the enumerate value and not its description.
Context
3GL library function.
Example
This example assumes an enumerated domain 'tcyesno' with two possible constants: 'tcyesno.yes' and 'tcyesno.no'. It also assumes a question defined in the data dictionary with code "tccom00001". This question contains the string "Error %d in file %s; Try again [y/n]?". The default answer is yes.
ret = seq.open( filename, "w" )
while ( ret <= 0 )
if ( ask.enum("tccom00001", tcyesno.yes, ret, filename )
= tcyesno.no) then
return
endif
ret = seq.open( filename, "w" )
endwhile
Related topics
|