FMX.MessageAlerts Sample
This sample uses ShowMessage and MessageDlg to shows how to pop up different alert messages.
Contents
Location
You can find the MessageAlerts sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
Object Pascal\Mobile Snippets\MessageAlerts
CPP\Mobile Snippets\MessageAlerts
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
The MessageAlerts sample shows how to pop up alert messages on iOS or Android devices. This shample shows two different alert messages that are named Standard One Button Alert and Multi Button Alert. For the Standard One Button Alert, the sample uses ShowMessage to show a simple message box that contains a text message and an OK button. For the Multi Button Alert, the sample uses MessageDlg to pop up a multiple-button alert that triggers different code blocks according to its input.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Delphi: MessageAlerts.dproj.
- C++: MessageAlerts.cbproj.
- Select the target platform, iOS and Android supported.
- Press F9 or choose Run > Run.
- Interact with the sample.
- Click Standard One Button Alert to see a simple alert message.
- Click Multi Button Alert to pop up a multiple-button alert message.
- Click one of the multiple buttons of the alert message.
Files
File in Delphi | File in C++ | Contains |
---|---|---|
MessageAlerts.dproj |
MessageAlerts.cbproj |
The project itself. |
uMain.fmx |
uMain.fmx |
The main form where the components are located. |
uMain.pas |
MessageAlertsPCH.h, MessageAlerts.cpp |
Used to define and implement the sample. |
Information.txt |
Information.txt |
Further information about the sample. |
Classes
TMessageAlertsForm is the main form that represents the main window of the sample. It contains the following components:
Implementation
- The sample uses Tbutton to pop up the alert messages.
When you run the application you see two different buttons named Standard One Button Alert and Multi Button Alert. If you click Standard One Button Alert, the sample uses ShowMessage to show a simple message box that contains a 'Hello World!' message and an OK button. If you click the Multi Button Alert, the sample uses MessageDlg to pop up a multiple-button alert that triggers a different message according to the button you choose.