TQS Home
Trivia Quiz Shell Version 2.8 Now Available!Bot Productions Home
 
TQS 2.7

Back to Reference

messageBox Function

Displays a message box on the screen.

Syntax
value = messageBox(message, caption, flags);
Parameters

message
The text of the message box.
caption
The caption to display in the message box's title bar. If not specified, the name of your TQS application is used.
flags
A value composed of bit flags that control the buttons and icon displayed in the message box. Pass a number from the button flags table, optionally adding a number the icon flags table if desired.

Button flags:

0OK button only (default)
1OK and Cancel buttons
2Abort, Retry, and Ignore buttons
3Yes, No, and Cancel buttons
4Yes and No buttons
5Retry and Cancel buttons
6Cancel, Try Again, and Continue buttons
(Requires Windows 2000, XP, or newer)

Icon flags:

16Error icon
32Question mark icon
48Exclamation icon
64Information icon
Returns

Returns an value corresponding to the button in the message box that the user clicked:

1OK
2Cancel
3Abort
4Retry
5Ignore
6Yes
7No
10Try Again
11Continue
Remarks

Use this function to display a custom message box to the user. The use of this function is preferred over the script functions alert and confirm.

Examples

The following displays a simple message box. Since no caption is specified, the TQS application's title will be used.

messageBox("That is correct!");

The following example asks the user a yes/no question. The value 36 represents 6 (Yes and No buttons) + 32 (Question mark icon). The code checks for the return value 6 to indicate whether Yes was pressed.

if(messageBox("Do you want to play again?",
  "Matching", 36) == 6)
{
  // play again
} else
{
  // do something else
}


©2016 Bot Productions. All rights reserved.Last Updated: January 5, 2006