NSB.MSGBOX(function, prompt[, buttons[, title]])
MSGBOX opens a dialog box, and waits for the user to tap on a button. While it is displayed, no other actions may be taken by the user. Unlike MsgBox, 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 advantages of this function are that title can be specified and that there are many more options for its appearance.
The function argument is the name of a subroutine or function in your program, which will be called when the control is dismissed. When the user clicks on button, function will be called with one of the values in the MsgBox Return Values table.
prompt, is a string expression that is displayed in the body of the dialog box. It can be plain text or HTML.
The optional parameter, buttons, is a numeric or string expression that specifies which buttons to draw and which icon to use. The default value for buttons is 0. Other values are obtained by adding the desired constants from the Button Constant table. The values vbCritical, vbQuestion, vbExclamation and VBInformation can be added to the button value to specify a preset icon.
buttons can also be a comma separated string of button names. In this case, the name of the button is returned. An example of a custom button string would be “btn1,btn2,btn3”. To have a preset icon, append its number to the string, as in "btn1,btn2,btn3;32" for three custom buttons and a question icon.
A custom icon can be specified by adding “;” and the name of the icon within the button string. The icon should be 33x33 pixels, but will be resized if different. For example, "btn1,btn2;images/customicon.gif" would result in two custom buttons and a custom image for icon.
The optional parameter, title, is a string expression that is displayed in the title bar of the dialog box. If title is not supplied, the title of the app is used.
To dismiss an NSB.MsgBox from your program instead of waiting for the user, call NSB.closeMsgBox().
TITLE = "MsgBox Tour" 'Simple Message NSB.MsgBox("Hello World!") 'Simple Message with a custom title NSB.MsgBox("Brief Tour of MSGBOX!",0, TITLE) 'Yes/No Prompt. Call yesNoDone when finished NSB.MsgBox(yesNoDone,"Do you like this tour?", vbYesNo+vbQuestion, TITLE) 'Three Custom Buttons. Call custDone when finished. NSB.MsgBox(custDone,"How is NS Basic/App Studio?", "Fun,Great,Sweet", TITLE) 'Custom Button and Icon NSB.MsgBox("Who is the Happy Guy?", "Mario;mario.jpg", TITLE) Sub yesNoDone(result) If result=vbYes Then Text1.value="Yes" Else Text1.value="No" End Sub Sub custDone(result) Text2.value=result End Sub
(depends on button. See nsbMsgBox sample)