Skip to content

YesNo_Box

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

Purpose

Displays a dialog box with Yes & No buttons.

Return Type

Integer

Syntax

Use Windows.pkg
(YesNo_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)

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

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

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

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

Examples

Use Windows.pkg

Procedure Example
    Integer eResponse
    Move (YesNo_Box("Delete this file?", "", MB_DEFBUTTON2)) to eResponse
    If (eResponse = MBR_YES) Begin
        Send DeleteFile
    End
End_Procedure

Notes

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