OK message

Command group Flag affected Reversible Execute on client Platform(s)
Message boxes NO NO YES All

Syntax

OK message title ([Icon][,Sound bell][,Cancel button]) {message}

Options

Icon If specified, the message displays an operating system specific icon
Sound bell If specified, the system bell sounds when the command displays the message
Cancel button If specified, the message has a cancel button

Description

This command displays the specified message and waits for the user to click the OK or Cancel button before continuing. Method execution is halted temporarily while the message box is displayed. Note: for JavaScript client-executed methods this command uses a standard alert() or confirm() dialog.

The number of message lines displayed depends on your operating system, fonts and screen size. In the message text you can force a break between lines (a carriage return) by using the notation "//" or the kCr constant enclosed in square brackets, e.g. 'First line[kCr]Second line'. Also you can add a short title for the message box.

For greater emphasis, you can pass the  Icon option to add an icon (the default "info" icon for the current operating system). If no icon is specified, the default action on macOS is to show the application icon (applies to Big Sur or later). You can force the system bell to sound by passing the Sound bell option.

The message box displayed by this command has an OK button by default, but you can add a Cancel button by passing the Cancel button option. After executing an OK message, the flag is unchanged, but you can use the msgcancelled() function to detect if the user pressed the Cancel button.

You can use square bracket notation in the message text to display the current value of fields and variables.

Example

`omnis # Open a Ok messsage dialog, if cancel is pressed abort printing Calculate lUserName as 'My Name' OK message My Editor (Icon,Cancel button) {Ready to print, press Ok to continue} If msgcancelled() OK message My Editor {Printing aborted by user [lUserName]} Quit method End If1`