InputBox: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "INPUTBOX(''prompt''[, ''title''[, ''default''[, ''xpos'', ''ypos'']]]) '''Description''' INPUTBOX opens a dialog box to prompt a user to input text or click a button. A stri..."
 
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
INPUTBOX(''prompt''[, ''title''[, ''default''[, ''xpos'', ''ypos'']]])
InputBox(''prompt''[, ''title''[, ''default'']])


'''Description'''
== Description ==


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 a string expression that is displayed in the title bar. The optional parameter, ''default'', is a string expression that is displayed in the text field of the dialog box. The optional parameters, ''xpos'' and ''ypos'', are numeric expressions that specify the horizontal and vertical distance between the upper left corner of the screen and the upper left corner 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), INPUTBOX returns EMPTY.
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 ==


<pre>
<tabber>
DIM Return
JavaScript=
Return = INPUTBOX("Message area", _
<syntaxhighlight lang="JavaScript">
  "INPUTBOX Example", "Default text")
var txtReturn;
PRINT "You entered:", Return
txtReturn = NSB.InputBox("Message area", "", "Default text")
</pre>
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'''
[[file:InputBox.jpg]]


<pre>
<pre>
GH: image needed
You entered:  Default Text
You entered:  Default Text
</pre>
</pre>
== Related Items ==
[[nsb.inputbox|Nsb.InputBox]]
[[Category:Language Reference]]
[[Category:Messages]]

Latest revision as of 06:29, 5 March 2022

InputBox(prompt[, title[, default]])

Description

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”.

Example

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

Output

You entered:  Default Text

Related Items

Nsb.InputBox