NSB.InputBox: Difference between revisions
No edit summary |
No edit summary |
||
(18 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
NSB. | [[File:NsbInputBoxAndroid.png]] | ||
NSB.InputBox(function, prompt[, title[, default]]) | |||
== Description == | == Description == | ||
Line 10: | Line 12: | ||
To dimiss an NSB.InputBox from your program instead of waiting for the user, call NSB.closeMsgBox(). | To dimiss an NSB.InputBox from your program instead of waiting for the user, call NSB.closeMsgBox(). | ||
The appearance of NSB.InputBox varies depending on whether it is running on an iOS or Android device. To override this, do | |||
<pre> | |||
NSB.MsgBoxStyle="" ' for iOS | |||
NSB.MsgBoxStyle="-android" 'for Android | |||
</pre> | |||
To override the description in the buttons, do this: | |||
<pre> | |||
NSB._["Cancel"]="Annuler" | |||
NSB._["OK"]="D'accord" | |||
</pre> | |||
== Example == | == Example == | ||
Line 16: | Line 30: | ||
Rem Demonstrate NSB.InputBox | Rem Demonstrate NSB.InputBox | ||
Function Button1_onclick() 'InputBox | Function Button1_onclick() 'InputBox | ||
NSB.InputBox( | NSB.InputBox(InputDone,"What am I thinking?", "InputBox Example", "Elephants") | ||
End Function | End Function | ||
Sub | Sub InputDone(result, value) | ||
If result=vbOK Then | If result=vbOK Then | ||
TextBox1.value=value | |||
Else | |||
TextBox1.value="Cancel" | |||
End If | |||
End Sub | End Sub | ||
</pre> | </pre> | ||
Line 35: | Line 53: | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Messages]] |
Latest revision as of 13:30, 12 February 2019
NSB.InputBox(function, prompt[, title[, default]])
Description
NSB.InputBox presents a modal dialog which prompts the user for an input value. While it is displayed, no other actions may be taken by the user. Unlike InputBox, this function does not halt the program: execution of the next statement will continue immediately. It will not wait for the user’s input. The advantage of this function is that title can be specified.
The function argument is the name of a subroutine or function in your program, which will be called when the control is dismissed. The prompt argument is required. It appears under the title. title is optional: if you do not specify one, the Title of the app will show. default is the initial value to show in the input field.
When the user clicks on OK or Cancel, function will be called with two parameters: the first one will be either vbOK or vbCancel, and the second one will be the value the user entered.
To dimiss an NSB.InputBox from your program instead of waiting for the user, call NSB.closeMsgBox().
The appearance of NSB.InputBox varies depending on whether it is running on an iOS or Android device. To override this, do
NSB.MsgBoxStyle="" ' for iOS NSB.MsgBoxStyle="-android" 'for Android
To override the description in the buttons, do this:
NSB._["Cancel"]="Annuler" NSB._["OK"]="D'accord"
Example
Rem Demonstrate NSB.InputBox Function Button1_onclick() 'InputBox NSB.InputBox(InputDone,"What am I thinking?", "InputBox Example", "Elephants") End Function Sub InputDone(result, value) If result=vbOK Then TextBox1.value=value Else TextBox1.value="Cancel" End If End Sub
Output
(If the user clicked on OK, the value entered will show in Text3.value. If the user cancelled,)