NSB.InputBox: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with " 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 edit summary
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:NsbInputBoxAndroid.png]]


NSB.InputBox(function, prompt[, title[, default]])


NSB.INPUTBOX(function, prompt[, title[, default]])
== Description ==
 
'''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.
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.
Line 13: Line 13:
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().  


'''Example'''
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>
<pre>
REM Demonstrate NSB.InputBox
NSB._["Cancel"]="Annuler"
NSB._["OK"]="D'accord"
</pre>
 
== Example ==
 
<pre>
Rem Demonstrate NSB.InputBox
Function Button1_onclick() 'InputBox
Function Button1_onclick() 'InputBox
   NSB.InputBox(Button6done,"What am I thinking?", "InputBox Example")
   NSB.InputBox(InputDone,"What am I thinking?", "InputBox Example", "Elephants")
End Function
End Function
   
   
Sub Button1done(result, value)
Sub InputDone(result, value)
   If result=vbOK Then Text3.value=value Else Text3.value="Cancel"
   If result=vbOK Then  
    TextBox1.value=value  
  Else  
    TextBox1.value="Cancel"
  End If
End Sub
End Sub
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 32: Line 48:
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[inputbox|InputBox]]
 
[[Category:Language Reference]]


[[inputbox|INPUTBOX]]
[[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,)

Related Items

InputBox