Back to Devexpress

dxShowMessagePos(string,Integer,Integer,TdxMessageDialogHyperlinkClickDelegate,TdxMessageDialogShowHyperlinkHintDelegate) Method

vcl-dxmessagedialog-dot-dxshowmessagepos-x28-ad86c527-x29.md

latest6.5 KB
Original Source

dxShowMessagePos(string,Integer,Integer,TdxMessageDialogHyperlinkClickDelegate,TdxMessageDialogShowHyperlinkHintDelegate) Method

Opens a generic message dialog box at a specified position on the screen.

Declaration

delphi
procedure dxShowMessagePos(const AMessage: string; X: Integer; Y: Integer; const AHyperlinkClickProc: TdxMessageDialogHyperlinkClickDelegate = nil; const AShowHyperlinkHintProc: TdxMessageDialogShowHyperlinkHintDelegate = nil);

Parameters

NameTypeDescription
AMessagestring

Message dialog box content. The AMessage parameter value initializes the created form’s Message property.

The AMessage parameter supports a set of BBCode-inspired tags that allow you to format message box content.

| | 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. Specifies a procedure that handles a click on a hyperlink within the displayed message. The AHyperlinkClickProc parameter value initializes the HyperlinkClickProc property of the created message dialog box form.

You can define a click handler procedure to identify the clicked hyperlink and prevent certain links from being activated.

Tip

Refer to the TdxMessageDialogHyperlinkClickDelegate procedural type description for detailed information and a code example.

| | AShowHyperlinkHintProc | TdxMessageDialogShowHyperlinkHintDelegate |

Optional. Specifies a procedure that handles a hyperlink hint display event. The AShowHyperlinkHintProc parameter value initializes the ShowHyperlinkHintProc property of the created message dialog box form.

You can define a hyperlink hint handler procedure to change the predefined hint message (the hyperlink target URI) depending on certain conditions in your application.

Tip

Refer to the TdxMessageDialogShowHyperlinkHintDelegate procedural type description for detailed information and a code example.

|

Remarks

Call the dxShowMessagePos procedure to display a generic message dialog box at a specified position on the screen. The created message dialog box has a specified formatted message and uses the Application.Title value as the title.

Code Example: Display a Message Dialog at the Mouse Pointer Position

The following code example displays a generic message dialog box at the mouse pointer position:

delphi
uses
  dxMessageDialog, // Declares the dxShowMessagePos method
  Winapi.Windows; // Declares WinAPI constants
// ...

procedure TMyForm.DemonstrateDxShowMessagePos1;
var
  AHelpURL, AMessage, ATitleURL: string;
  APointer: TPoint;
begin
  // Define a formatted message with hyperlinks (using the BBCode-inspired markup)
  AHelpURL := 'https://docs.devexpress.com/VCL/dxMessageDialog.dxShowMessagePos(AD86C527)';
  ATitleURL := 'https://docwiki.embarcadero.com/Libraries/en/Vcl.Forms.TApplication.Title';
  AMessage := 
    '[URL=' + AHelpURL + ']dxShowMessagePos[/URL] ' +
    'displays a generic message dialog box at specific screen coordinates.' +
    sLineBreak + sLineBreak +
    'The message box has a formatted message ([B]AMessage[/B]) and an [B]OK[/B] button, ' +
    ' and uses the [URL=' + ATitleURL + ']Application.Title[/URL] value as the title.';

  APointer := Mouse.CursorPos; // Obtains mouse pointer coordinates
  // Display a message box at the mouse pointer position
  dxShowMessagePos(AMessage, APointer.X, APointer.Y);
  end;
cpp
#include "dxMessageDialog.hpp" // Declares the dxShowMessagePos method
#include <Winapi.Windows.hpp> // Declares WinAPI constants

// Add the following linker directive to the corresponding CPP source file:
#pragma link "dxMessageDialog" // Required to use dxMessageDialog.hpp declarations
// ...

void __fastcall TMyForm::DemonstrateDxShowMessagePos1()
{
  UnicodeString AMessage, AHelpURL, ATitleURL;
  TPoint APointer;

  // Define a formatted message with hyperlinks (using the BBCode-inspired markup)
  AHelpURL = "https://docs.devexpress.com/VCL/dxMessageDialog.dxShowMessagePos(AD86C527)";
  ATitleURL = "https://docwiki.embarcadero.com/Libraries/en/Vcl.Forms.TApplication.Title";
  AMessage =
    "[URL=" + AHelpURL + "]dxShowMessagePos[/URL] "
    "displays a generic message dialog box at specific screen coordinates." +
    sLineBreak + sLineBreak +
    "The message box has a formatted message ([B]AMessage[/B]) and an [B]OK[/B] button, "
    " and uses the [URL=" + ATitleURL + "]Application.Title[/URL] value as the title.";

  APointer = Mouse->CursorPos; // Obtains mouse pointer coordinates
  // Display a message box at the mouse pointer position
  dxShowMessagePos(AMessage, APointer.X, APointer.Y);
}

See Also

Message Dialog Boxes

TdxMessageDialogForm.Create Constructor

BBCode-Inspired Text Formatting Markup

dxMessageDialog Unit