← Back to Index

TFlexFMXMessageDialog

Modern Bootstrap-style modal dialog for displaying messages with customizable buttons.

Key Properties

Title: string
Dialog title text.
Message: string
Main message content.
MessageType: TMessageType
Type: mtInformation, mtWarning, mtError, mtConfirmation, mtCustom.
Buttons: TDialogButtons
Button configuration: dbOK, dbOKCancel, dbYesNo, dbYesNoCancel, dbCustom.
DefaultButton: TDialogButton
Which button has focus by default.
ShowIcon: Boolean
Display message type icon.
CustomButtons: TStringList
Custom button captions (when Buttons = dbCustom).
ModalResult: TModalResult
Result after dialog closes (mrOK, mrCancel, mrYes, mrNo, etc.).

Usage Examples

Simple Information

Dialog1.Title := 'Information';
Dialog1.Message := 'Settings have been saved';
Dialog1.MessageType := mtInformation;
Dialog1.Buttons := dbOK;
Dialog1.Execute;

Confirmation

Dialog1.Title := 'Confirm Delete';
Dialog1.Message := 'Are you sure you want to delete this item?';
Dialog1.MessageType := mtConfirmation;
Dialog1.Buttons := dbYesNo;
if Dialog1.Execute = mrYes then
  DeleteItem;

Error with Details

Dialog1.Title := 'Error';
Dialog1.Message := 'Connection failed: ' + E.Message;
Dialog1.MessageType := mtError;
Dialog1.Buttons := dbOK;
Dialog1.Execute;

Custom Buttons

Dialog1.Title := 'Choose Action';
Dialog1.Message := 'What would you like to do?';
Dialog1.Buttons := dbCustom;
Dialog1.CustomButtons.Clear;
Dialog1.CustomButtons.Add('Save');
Dialog1.CustomButtons.Add('Discard');
Dialog1.CustomButtons.Add('Cancel');
case Dialog1.Execute of
  mrYes: SaveChanges;      // First button
  mrNo: DiscardChanges;     // Second button
  mrCancel: Exit;           // Third button
end;

Methods

Events

Notes

← Back to Index