Class

# MobileMessageBox

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to asynchronously display alerts.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                        | Type                             | Read-Only | Shared |
|---------------------------------------------|----------------------------------|-----------|--------|
| `LeftButton<mobilemessagebox.leftbutton>`   | `String</api/data_types/string>` |           |        |
| `Message<mobilemessagebox.message>`         | `String</api/data_types/string>` |           |        |
| `Name<mobilemessagebox.name>`               | `String</api/data_types/string>` | ✓         |        |
| `RightButton<mobilemessagebox.rightbutton>` | `String</api/data_types/string>` |           |        |
| `Title<mobilemessagebox.title>`             | `String</api/data_types/string>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                | Parameters                                                                   | Returns                                     | Shared |
|-------------------------------------|------------------------------------------------------------------------------|---------------------------------------------|--------|
| `Buttons<mobilemessagebox.buttons>` |                                                                              | `String()</api/data_types/string>`          |        |
|                                     | `Assigns</api/language/assigns>` value() As `String</api/data_types/string>` |                                             |        |
| `Handle<mobilemessagebox.handle>`   |                                                                              | `Ptr</api/data_types/additional_types/ptr>` |        |
| `Show<mobilemessagebox.show>`       |                                                                              |                                             |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                | Parameters                                        | Returns |
|-------------------------------------|---------------------------------------------------|---------|
| `Closing<mobilemessagebox.closing>` |                                                   |         |
| `Opening<mobilemessagebox.opening>` |                                                   |         |
| `Pressed<mobilemessagebox.pressed>` | buttonIndex As `Integer</api/data_types/integer>` |         |

## Property descriptions

<div id="mobilemessagebox.leftbutton">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.LeftButton

**LeftButton** As `String</api/data_types/string>`

> The caption of the button on the left side of the dialog box.
>
> This is a **design-time-only** property.

<div id="mobilemessagebox.message">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Message

**Message** As `String</api/data_types/string>`

> A longer message that appears below the title in the message box.
>
> Set the message:
>
> ``` xojo
> MessageBox1.Message = "Would you like to update this information?"
> ```

<div id="mobilemessagebox.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Name

**Name** As `String</api/data_types/string>`

> The name of the control.

<div id="mobilemessagebox.rightbutton">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.RightButton

**RightButton** As `String</api/data_types/string>`

> The caption of the button on the right side of the dialog box.
>
> This is a **design-time-only** property.

<div id="mobilemessagebox.title">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Title

**Title** As `String</api/data_types/string>`

> The title of the message box, which appears at the top.
>
> Set the title:
>
> ``` xojo
> MessageBox1.Title = "Warning"
> ```

## Method descriptions

<div id="mobilemessagebox.buttons">

<div class="rst-class">

forsearch

</div>

</div>

MobileMessageBox.Buttons

**Buttons** As `String()</api/data_types/string>`

> Gets the buttons for the message box.

**Buttons**(`Assigns</api/language/assigns>` value() As `String</api/data_types/string>`)

> Sets the buttons for the message box.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> When there are only one or two buttons, they are shown side-by-side. The first button displays as bold. When there are more than two buttons, they are shown vertically. The first button added is the default and displays as bold at the bottom. The remaining buttons are in added in order an appear above the default button.
>
> </div>
>
> Displays a message box with multiple buttons. HelloMessage is an <span class="title-ref">MobileMessageBox</span> that was dragged onto the Screen from the Library:
>
> ``` xojo
> HelloMessage.Title = "Hello"
> HelloMessage.Message = "Hello, World!"
>
> Var buttons() As String = Array("Yes", "No", "Maybe")
>
> HelloMessage.Buttons = buttons
>
> HelloMessage.Show
> ```

<div id="mobilemessagebox.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> The handle to the underlying native OS control.

<div id="mobilemessagebox.show">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Show

**Show**

> Displays the message box. This is not modal, so your code continues to run. When the user selects a button, the `Pressed<mobilemessagebox.pressed>` event handler is called.
>
> Displays a message box. HelloMessage is a <span class="title-ref">MobileMessageBox</span> that was dragged onto the Screen from the Library:
>
> ``` xojo
> HelloMessage.Title = "Hello"
> HelloMessage.Message = "Hello, World!"
> HelloMessage.Show ' Not modal, so code does not pause here
> ```

## Event descriptions

<div id="mobilemessagebox.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Closing

**Closing**

> Called when the control's layout is closing.

<div id="mobilemessagebox.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Opening

**Opening**

> Called when the control's layout is opening.
>
> This is where you typically put initialization code.
>
> This example in the Opening event of a label sets its text to "Hello":
>
> ``` xojo
> Me.Text = "Hello"
> ```

<div id="mobilemessagebox.pressed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileMessageBox.Pressed

**Pressed**(buttonIndex As `Integer</api/data_types/integer>`)

> Called when the button at buttonIndex is selected.
>
> Displays the index of the selected button:
>
> ``` xojo
> Label1.Text = "You selected button " + buttonIndex.ToString
> ```

## Notes

<span class="title-ref">MobileMessageBox</span> is asynchronous, any code after the Show method is executed after the message box is displayed. Use the `Pressed<mobilemessagebox.pressed>` event handler to get the results of a button selection and to run code based on the selection.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### iOS UI guidelines

Apple provides [user interface guidelines](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Alerts.html) for the text and buttons in a MessageBox.

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | All    |

<div class="seealso">

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; `MessageBox</api/user_interface/messagebox>` method, `MobilePopupMessage</api/user_interface/mobile/mobilepopupmessage>` class.

</div>
