[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Dialogs' (#lcl)

MessageDlg

Shows a message to the user and gets the response.

Declaration

Source position: dialogs.pp line 697

function MessageDlg(

  const aMsg: string;

  DlgType: TMsgDlgType;

  Buttons: TMsgDlgButtons;

  HelpCtx: LongInt

):TModalResult; overload;

function MessageDlg(

  const aCaption: string;

  const aMsg: string;

  DlgType: TMsgDlgType;

  Buttons: TMsgDlgButtons;

  HelpCtx: LongInt

):TModalResult; overload;

function MessageDlg(

  const aCaption: string;

  const aMsg: string;

  DlgType: TMsgDlgType;

  Buttons: TMsgDlgButtons;

  HelpCtx: LongInt;

  DefaultButton: TMsgDlgBtn

):TModalResult; overload;

function MessageDlg(

  const aMsg: string;

  DlgType: TMsgDlgType;

  Buttons: TMsgDlgButtons;

  HelpCtx: LongInt;

  DefaultButton: TMsgDlgBtn

):TModalResult; overload;

function MessageDlg(

  const aCaption: string;

  const aMsg: string;

  DlgType: TMsgDlgType;

  Buttons: TMsgDlgButtons;

  const HelpKeyword: string

):TModalResult; overload;

Arguments

aMsg

  

The message to be shown.

DlgType

  

The type of dialog to be shown.

Buttons

  

Determines the buttons shown on the message dialog.

HelpCtx

  

HelpCtx is used to specify which topic from the help should be shown.

Function result

The result of this function is the button the user pressed to close the dialog expressed as an integer.

If the user clicks the [X]-bordericon, the return value will be mrCancel.

If the user presses the escape key, the result depends on the widgetset:

Arguments

aCaption

  

Used to set the caption of the message dialog.

aMsg

  

The message to be shown.

DlgType

  

The type of dialog to be shown.

Buttons

  

Determines the buttons shown on the message dialog.

HelpCtx

  

HelpCtx is used to specify which topic from the help should be shown.

Arguments

aCaption

  

Used to set the caption of the message dialog.

aMsg

  

The message to be shown.

DlgType

  

The type of dialog to be shown.

Buttons

  

Determines the buttons shown on the message dialog.

HelpCtx

  

HelpCtx is used to specify which topic from the help should be shown.

DefaultButton

  

The default button when the message dialog is executed.

Arguments

aMsg

  

The message to be shown.

DlgType

  

The type of dialog to be shown.

Buttons

  

Determines the buttons shown on the message dialog.

HelpCtx

  

HelpCtx is used to specify which topic from the help should be shown.

DefaultButton

  

The default button when the message dialog is executed.

Arguments

aCaption

  

Used to set the caption of the message dialog.

aMsg

  

The message to be shown.

DlgType

  

The type of dialog to be shown.

Buttons

  

Determines the buttons shown on the message dialog.

HelpKeyword

  

Help keyword for the message dialog.

Description

There are four versions of this function.

The first version displays a dialog with the standard caption. The second, third and fourth versions enable you to set the caption.

The third version allows for a Default button.

The fourth version contains a help keyword instead of using context-based help.

If the first Caption argument is missing, no caption is shown on the box.

This is the most complete and elaborate of the message dialogs, and allows the programmer considerable control over the appearance of the dialog box.

The arguments defining the kind of box and its icon are types rather than integer constants, and the buttons can be specified as a set in square brackets e.g. [mbRetry, mbIgnore, mbAbort, mbCancel].

The HelpCtx argument allows the use of Context Help

The return value from the Function is the identity of the button pressed, expressed as an integer (see the constant definitions in TControl , [mrNone..mrAll]).

If the user clicks the [X]-bordericon, the return value will be mrCancel.

If the user presses the escape key, the result depends on the widgetset:

Example

 
 Uses forms, dialogs, lcltype, controls;
 
 procedure TryMessageDlg;
 begin
   if MessageDlg ('Question', 'Do you wish to Execute?', mtConfirmation, 
                  [mbYes, mbNo, mbIgnore],0) = mrYes
   then { Execute rest of Program };
  end;

Version 3.2 Generated 2024-02-25 Home