var txtReturn;
txtReturn = NSB.InputBox("Message area", "", "Default text")
NSB.Print("You entered: " + txtReturn);
No edit summary |
|||
(6 intermediate revisions by 4 users not shown) | |||
Line 5: | Line 5: | ||
InputBox opens a dialog box to prompt a user to input text or click a button. A string is returned containing the contents of the text field from the dialog box. The required parameter, ''prompt'', is a string expression that is displayed in the body of the dialog box. The optional parameter, ''title'', is ignored: it is only for backwards compatibility. The optional parameter, ''default'', is a string expression that is displayed in the text field of the dialog box. | InputBox opens a dialog box to prompt a user to input text or click a button. A string is returned containing the contents of the text field from the dialog box. The required parameter, ''prompt'', is a string expression that is displayed in the body of the dialog box. The optional parameter, ''title'', is ignored: it is only for backwards compatibility. The optional parameter, ''default'', is a string expression that is displayed in the text field of the dialog box. | ||
If the user taps OK or presses the Enter key, InputBox returns the text in the input field or an empty string ("") if the input field is empty; if the user taps Cancel or presses the escape key (Esc), | If the user taps OK or presses the Enter key, InputBox returns the text in the input field or an empty string ("") if the input field is empty; if the user taps Cancel or presses the escape key (Esc), InputBox returns “null”. | ||
== Example == | == Example == | ||
< | <tabber> | ||
Dim | JavaScript= | ||
<syntaxhighlight lang="JavaScript"> | |||
Print "You entered:", | var txtReturn; | ||
</ | txtReturn = NSB.InputBox("Message area", "", "Default text") | ||
NSB.Print("You entered: " + txtReturn); | |||
</syntaxhighlight> | |||
|-| | |||
BASIC= | |||
<syntaxhighlight lang="vb.net"> | |||
Dim txtReturn | |||
txtReturn = InputBox("Message area", "", "Default text") | |||
Print "You entered:", txtReturn | |||
</syntaxhighlight> | |||
</tabber> | |||
== Output == | == Output == | ||
Line 28: | Line 38: | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Messages]] |
InputBox(prompt[, title[, default]])
InputBox opens a dialog box to prompt a user to input text or click a button. A string is returned containing the contents of the text field from the dialog box. The required parameter, prompt, is a string expression that is displayed in the body of the dialog box. The optional parameter, title, is ignored: it is only for backwards compatibility. The optional parameter, default, is a string expression that is displayed in the text field of the dialog box.
If the user taps OK or presses the Enter key, InputBox returns the text in the input field or an empty string ("") if the input field is empty; if the user taps Cancel or presses the escape key (Esc), InputBox returns “null”.
var txtReturn;
txtReturn = NSB.InputBox("Message area", "", "Default text")
NSB.Print("You entered: " + txtReturn);
Dim txtReturn
txtReturn = InputBox("Message area", "", "Default text")
Print "You entered:", txtReturn
You entered: Default Text