MESSAGEBOX

Action

Displays a standard dialog box in Windows.

 

Syntax

MESSAGEBOX ("message", "title", style, time-out)

 

Parameters

Message

The message to display in the dialog box.

Title

The title of the dialog box.

Style

Optional numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality. The following table illustrates the values used and the meaning of each group of values.

 

Buttons to display

Value

Meaning

0

Display OK button only.

1

Display OK and Cancel buttons.

2

Display Abort, Retry, and Ignore buttons.

3

Display Yes, No, and Cancel buttons.

4

Display Yes and No buttons.

5

Display Retry and Cancel buttons.

 

Icon to display

Value

Meaning

16

Stop symbol

32

Question mark

48

Exclamation mark

64

Information symbol

 

Default button

Value

Meaning

0

First button is default.

256

Second button is default.

512

Third button is default.

 

Modality

Value

Meaning

0

Application-modal. The user must respond to the message box before continuing work in the application.

4096

System-modal. All applications are suspended until the user responds to the message box.

 

When adding numbers to create a final value for the argument type, use only one number from each group. If style is omitted, a default value of 0 is assumed.

Time-out

Optional numeric expression representing the number of seconds after which to close the dialog box.

 

Note

The time-out feature only works if the MESSAGEBOX dialog box is the active window for the duration of the time-out. If the user switches away from KiXtart and activates another application, the MESSAGEBOX dialog box is not closed.

 

Remarks

MESSAGEBOX displays a maximum of 1024 characters in application-modal dialog boxes. Longer messages are truncated after the 1024th character. Message strings longer than 255 characters with no intervening spaces are truncated after the 255th character. For system-modal dialog boxes, the number of characters you can display depends on screen resolution and number of lines in the message.

 

MESSAGEBOX breaks lines automatically at the right edge of the dialog box. If you want to set line breaks yourself, place a linefeed (ANSI character 10) before the first character of the text that is to begin each new line.

 

Returns

The value returned by MESSAGEBOX indicates which button was selected, as shown in the following table.

 

Value

Meaning

-1

User did not respond to the dialog box within the specified time-out period.

1

OK button selected.

2

Cancel button selected.

3

Abort button selected.

4

Retry button selected.

5

Ignore button selected.

6

Yes button selected.

7

No button selected.

 

If the dialog box contains a Cancel button, pressing esc has the same effect as choosing Cancel.

 

Example

$Selection = MessageBox("Do you want to continue ?", "KiXtart", 36)

If $Selection = 6

   ? "Yes selected, continuing...."

Endif