dxMessageDlgPos(string,TMsgDlgType,TMsgDlgButtons,Longint,Integer,Integer,TdxMessageDialogHyperlinkClickDelegate,TdxMessageDialogShowHyperlinkHintDelegate,TdxMessageDialogHintedTextClickDelegate,TdxMessageDialogShowTextHintDelegate) Method
Opens a message dialog box at a specified position on the screen.
Declaration
function dxMessageDlgPos(const AMessage: string; ADialogType: TMsgDlgType; AButtons: TMsgDlgButtons; AHelpContext: Longint; X: Integer; Y: Integer; const AHyperlinkClickProc: TdxMessageDialogHyperlinkClickDelegate = nil; const AShowHyperlinkHintProc: TdxMessageDialogShowHyperlinkHintDelegate = nil; const AHintedTextClickProc: TdxMessageDialogHintedTextClickDelegate = nil; const AShowTextHintProc: TdxMessageDialogShowTextHintDelegate = nil): Integer;
Parameters
| Name | Type | Description |
|---|---|---|
| AMessage | string | Message dialog box content. The The |
| ADialogType | TMsgDlgType | A message dialog box type that determines the predefined caption, system icon, and sound of the message dialog box. This parameter value initializes the created form’s DialogType property. |
| AButtons | TMsgDlgButtons | A set of buttons on the message dialog box form. |
| AHelpContext | Longint | A context ID of the help topic associated with the created message box. Users can click the Help button or press F1 to open the associated help topic. |
| X | Integer | A horizontal offset (in pixels) of the upper-left dialog corner from the upper-left screen corner. |
| Y | Integer | A vertical offset (in pixels) of the upper-left dialog corner from the upper-left screen corner. |
| AHyperlinkClickProc | TdxMessageDialogHyperlinkClickDelegate | Optional. A procedure that handles clicks on hyperlinks in the displayed message. For example, use this procedure to identify the clicked hyperlink and prevent specific links from being activated. This parameter value initializes the HyperlinkClickProc property of the created message dialog box form. Refer to the procedural type description for detailed information and a code example: TdxMessageDialogHyperlinkClickDelegate. |
| AShowHyperlinkHintProc | TdxMessageDialogShowHyperlinkHintDelegate | Optional. A procedure that handles hyperlink hint display events. For example, use this procedure to modify the predefined hint message (the hyperlink target URI) based on conditions in your application. This parameter value initializes the ShowHyperlinkHintProc property of the created message dialog box form. Refer to the procedural type description for detailed information and a code example: TdxMessageDialogShowHyperlinkHintDelegate |
| AHintedTextClickProc | TdxMessageDialogHintedTextClickDelegate | Optional. A procedure that handles clicks on hint-marked text ranges in the displayed message. For example, use this procedure to identify the clicked text range. This parameter value initializes the HintedTextClickProc property of the created message dialog box form. Refer to the procedural type description for detailed information and a code example: TdxMessageDialogHintedTextClickDelegate. |
| AShowTextHintProc | TdxMessageDialogShowTextHintDelegate | Optional. A procedure that handles hint display events for hint-marked text ranges enclosed between [HINT] and [\HINT] tags. For example, use this procedure to modify the hint message based on conditions in your application. This parameter value initializes the ShowTextHintProc property of the created message dialog box form. Refer to the procedural type description for detailed information and a code example: TdxMessageDialogShowTextHintDelegate. |
Returns
| Type | Description |
|---|---|
| Integer | The ID of the button clicked to close the message box. The function returns Refer to the list of possible return values in the Remarks section. |
Remarks
Call the dxMessageDlgPos function to open a message dialog box at a specified position on the screen. You can specify dialog type, message, a set of buttons, and an associated help context.
The opened message dialog box has the mdsMessageDlg style.

Code Example: Display a Message Dialog at the Mouse Pointer Position
The code example in this section opens a message dialog box at the mouse pointer position. The message dialog has a formatted message and a configured button layout. The demonstrated procedure identifies the action used to close the message box.
uses
dxMessageDialog, // Declares the dxMessageDlgPos method
Winapi.Windows; // Declares WinAPI constants
// ...
procedure TMyForm.DemonstrateDxMessageDlgPos1;
var
AMessage, AHelpURL: string;
ADialogType: TMsgDlgType;
AButtons: TMsgDlgButtons;
AHelpContext, ACloseAction: Integer;
APointer: TPoint;
begin
// Define a formatted message with a hyperlink (using the BBCode-inspired markup)
AHelpURL := 'https://docs.devexpress.com/VCL/dxMessageDialog.dxMessageDlgPos(27D2BCB9)';
AMessage := '[URL=' + AHelpURL + ']dxMessageDlgPos[/URL] opens a message dialog box ' +
'at specific screen coordinates ([B]X[/B], [B]Y[/B]). The message box has ' +
'a formatted message ([B]AMessage[/B]) and a set of buttons ([B]AButtons[/B]).';
ADialogType := mtInformation; // Defines the "Information" dialog title, icon, and sound
AButtons := mbYesNoCancel; // Defines a button set (Yes, No, and Cancel)
AHelpContext := 0; // Retains the default help context
APointer := Mouse.CursorPos; // Obtains mouse pointer coordinates
// Display a message box at the mouse pointer position
ACloseAction :=
dxMessageDlgPos(AMessage, ADialogType, AButtons, AHelpContext, APointer.X, APointer.Y);
// Identify the action used to close the message box
case ACloseAction of
IDYES: Caption := 'Yes is clicked';
IDNO: Caption := 'No is clicked';
IDCANCEL: Caption := 'Cancel is clicked';
0: Caption := 'Failed to create a message box';
end;
end;

Return Values
The return value identifies the action used to close the message box:
- IDOK
- A user clicked the OK button to close the message box.
- IDCANCEL
- A user clicked the Cancel or Close button, or pressed Esc to close the message box.
- IDABORT
- A user clicked the Abort button to close the message box.
- IDRETRY
- A user clicked the Retry button to close the message box.
- IDIGNORE
- A user clicked the Ignore button to close the message box.
- IDYES
- A user clicked the Yes button to close the message box.
- IDNO
- A user clicked the No button to close the message box.