Yes/No message

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

Syntax

Yes/No 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 a message box containing the specified message and provides a Yes and a No pushbutton. You can include a Cancel button, and add a short title for the message box. For greater emphasis, you can select an Icon for the message box (the default "info" icon for the current operating system), and you can force the system bell to sound by checking the Sound bell check box. Under Windows XP, you have to specify a system sound for a 'Question' in the Control Panel for the Sound Bell option to work.

When the message box is displayed method execution is halted temporarily; it remains open until the user clicks on one of the buttons before continuing. The Yes button is the default button and can therefore be selected by pressing the Return key.

The number of lines displayed in the message box 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'.

You can insert a Yes/No message at any appropriate point in a method. If the user clicks the Yes button, the flag is set; otherwise, it is cleared. You can use the msgcancelled() function to detect if the user pressed the Cancel button.

Example

# Open a Yes/No dialog and display the option selected
Yes/No message My Editor (Icon,Cancel button) {Do you wish to save the changes you have made ?}
If msgcancelled()
  OK message My Editor {Cancel button pressed}
Else
  If flag true
    OK message My Editor {OK button pressed}
  Else
    OK message My Editor {Cancel button pressed}
  End If
End If