No/Yes message

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

Syntax

No/Yes 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 No and a Yes pushbutton. You can include a Cancel button by checking the Cancel button option. 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 No 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'. Also you can 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.

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

Example

; Open a No/Yes dialog and display the option selected
No/Yes 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