## MsgBox

### Description

The MsgBox class implements the pre-defined message-box dialog. This is a top-level object (i.e. it should not be opened as the child of a window).

To use the dialog, you must first create it as a top-level object using the `New` method; it will remain hidden at this stage. You can then set up the dialog using the following properties:

`caption`: The dialog title as a character vector.

`text`: The text to appear in the message-box, as a character vector.

`style`: The buttons to appear in the message-box, as an integer scalar. Valid values are:

         0 = OK only
         1 = OK and Cancel
         2 = Retry and Cancel
         3 = Yes and No
         4 = Yes, No and Cancel
         5 = Abort, Retry and Ignore

`icon`: Icon as an integer scalar (default 0):

         0 = Stop
         1 = Alert
         2 = Note
         3 = Question
         -1 = None

`default`: The button to use as the default (1 to 4 - see button numbers below)

#### Displaying the dialog

When you are ready to show the dialog, call the `Show` method. This displays the modal dialog, and waits for the user to press one of the buttons. The `Show` method returns the button which the user pressed to end the dialog:

         1  = OK
         2  = Cancel
         3  = Abort
         4  = Retry
         5  = Ignore
         6  = Yes.
         7  = No
        ¯1  = The dialog ended without a button being clicked

Finally, you will normally call the `Delete` method to dispose of the dialog. Alternatively, you can keep it for re-use later in your application.

### Example

         ’DEMO_MsgBox;DLG
    [1]   © Sample function demonstrating use of the MsgBox object
    [2]   DLG„'Œ' ŒNEW 'MsgBox' ª DLG.icon„2 ª DLG.style„1
    [3]   DLG.caption„'Sample Message'
    [4]   DLG.text„'Sounds fun. Shall we do it?'
    [5]   © Show the dialog. If user presses Cancel, quit
    [6]   …(2=DLG.Show)/0
    [7]   © He pressed OK.
    [8]   'OK, let''s do it!'
         ’

### Properties

caption children class data default events icon methods name opened properties self style text tie

### Methods

Close Create Delete New Open Send Set Show Trigger

### Callbacks

onClose onDestroy onOpen onSend

Topic: APLX Help : System Classes : List of Classes : MsgBox

[ Previous | Next | Contents | Index ]