Skip to content

YesNoCancel_Box

See Also: Dialog and Message Box Functions, Info_Box, Message_Box, Stop_Box, YesNo_Box

Purpose

Displays a dialog box with Yes, No & Cancel buttons.

Return Type

Integer

Syntax

Use Windows.pkg
(YesNoCancel_Box( {sMessage} [, {sCaption} [, {Default-Button} ] ] ))

Where:

  • {sMessage}: A string containing the information message to be shown. A carriage-return/linefeed can be placed in the message string by the inclusion of \n in the text.

  • {sCaption}: The {sCaption} parameter is optional. If passed, it specifies the content of the caption bar. If {sCaption} is not passed, the caption bar will display the string "Question".

  • {Default-Button}: The {Default-Button} parameter is optional. If passed, it will specify which button will be the default. If not passed, the first button (Yes) will be the default. Valid default buttons are specified by the following constants:

  • MB_DEFBUTTON1 (Yes)
  • MB_DEFBUTTON2 (No)
  • MB_DEFBUTTON3 (Cancel)

If you wish to specify a default button but not a caption, pass two quotation marks (null) as {sCaption}, followed by the desired default button.

What It Does

YesNoCancel_Box is used to pop a Yes/No/Cancel confirmation message box and obtain the user's response. The passed message {sMessage} is displayed along with the Information icon, a Yes button, a No button, and a Cancel button.

The return value will be one of three predefined message-box return values:

  • MBR_YES (Yes was selected)
  • MBR_NO (No was selected)
  • MBR_CANCEL (Cancel was selected)

Examples

Use Windows.pkg
Procedure Example
    Integer eResponse
    Move (YesNoCancel_Box("Save the current setup profile?")) to eResponse
    If (eResponse = MBR_CANCEL) ;
        Procedure_Return
    If (eResponse = MBR_YES) ;
        Send DoSomething
        Send DoSomethingElse
End_Procedure

Notes

If the user types Ctrl+C in the message box, the text of the message is copied to the clipboard.