Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.6.3 MessageBox (display a message in a dialog box)

Purpose

Displays a specified message in a dialog box. Buttons or icons may be added. When the box has buttons, the command returns a value indicating which button the user clicked.

Syntax
MessageBox (Text, [Buttons], [DefaultBtn], [IconStyle], [ModalStyle] [, Title])
Arguments
Text

Specify the message string to be displayed in the dialog box. Write a character string or a variable that stores this value. If #Option = NOCHANGE is missing from the head of the script file, any \r, \n, \t, or \\ strings included in the message text are processed as control codes.

For details about control codes, see 6.1.11 Script coding conventions.

Buttons

Specify the types and number of buttons to add to the dialog box as one of the following values:

Value

Meaning

OK

Display an OK button only.

OKCancel

Display OK and Cancel buttons.

YesNo

Display Yes and No buttons.

YesNoCancel

Display Yes, No, and Cancel buttons.

RetryCancel

Display Retry and Cancel buttons.

AbortRetryIgnore or Abort

Display Abort, Retry, and Ignore buttons.

This value is optional. If you omit this value, the dialog box will have an OK button only.

DefaultBtn

Specify which of the buttons you set in the Buttons argument is to be the default button. Enter one of the following values:

Value

Meaning

1

Make the first button the default.

2

Make the second button the default.

3

Make the third button the default.

This value is optional. If you omit this value, 1 is assumed.

IconStyle

Specify the style of the icon to add to the dialog box as one of the following values:

Value

Meaning

Exclamation or Ex

Exclamation mark (!)

Information or Info

Letter i inside a circle

Question

Question mark (?)

Stop

STOP

This value is optional. If you omit this value, the dialog box will have no icon.

ModalStyle

Specify whether the dialog box is modal. Use either of the following values:

Value

Meaning

ApplicationModal or AppliModal

Set the dialog box to Application Modal. The user can move and work in a window in another application.

SystemModal or SysModal

Set the dialog box to System Modal. Use this value for notifying the user of a critical error that requires immediate attention.

This value is optional. If you omit this value, ApplicationModal is assumed.

Title

Specify the title to be displayed in the title bar as a character string or as a variable that stores this value.

This value is optional. If you omit this value, JP1/Script MessageBox appears in the title bar.

Description

The MessageBox command displays a message box according to the specified parameters. The command returns True on successful execution, or False if an error occurs.

The value of the button that the user chooses is stored in the _MSG_RTN_ reserved variable as either of the following:

Value

Button chosen by the user

OK

OK

CANCEL

Cancel

ABORT

Abort

RETRY

Retry

IGNORE

Ignore

YES

Yes

NO

No

In a dialog box with a Cancel button, pressing the Esc key has the same effect as clicking Cancel.

Note

You cannot use this command in a script started as a service. An execution error occurs if this command is used.

Example
MessageBox ("Are you sure you want to exit?", OKCancel, ,_
             Question)
If  _MSG_RTN_ <> CANCEL  Then
  Exit
End

Display example

[Figure]

JP1/Script version

Supported from JP1/Script 01-00.