User confirm: Difference between revisions
Jump to navigation
Jump to search
imported>Roippi update for user_confirm() overloaded signature |
imported>AlbinoRhino mNo edit summary |
||
Line 24: | Line 24: | ||
p1desc={{pspan|message}} is the text to display in the confirmation pop-up| | p1desc={{pspan|message}} is the text to display in the confirmation pop-up| | ||
p2desc={{pspan|timeOutMillis}} the length of time to display the dialog, in milliseconds| | p2desc={{pspan|timeOutMillis}} the length of time to display the dialog, in milliseconds| | ||
p3desc={{pspan| | p3desc={{pspan|defaultValue}} the value to return if the user does not choose an input before <b>timeOutMillis</b> ms| | ||
}}| | }}| | ||
Revision as of 12:40, 19 November 2017
Function Syntax
boolean user_confirm(string message )
boolean user_confirm(string message ,int timeOutMillis ,boolean defaultValue )
- message is the text to display in the confirmation pop-up
- timeOutMillis the length of time to display the dialog, in milliseconds
- defaultValue the value to return if the user does not choose an input before timeOutMillis ms
Presents the user with a pop-up dialog box with the text in message (can use escaped characters, such as "\n" for a newline); returns true if the user selects "Yes" and false if the user selects "No."
If you wish for the dialog to "time out" and return a default value if the user does not select an option, use the three-parameter version.
Please use these sparingly, as it can defeat the purpose of scripting if the user must constantly provide information during execution.
Code Sample
A check to see if the user truly wants to execute a script.
if (!user_confirm("Are you sure you want to proceed with executing this script?") )
{
abort("Script execution canceled by user.");
}