Back to Devexpress

dxShowMessageFmt(string,Untyped[],TdxMessageDialogHyperlinkClickDelegate,TdxMessageDialogShowHyperlinkHintDelegate) Method

vcl-dxmessagedialog-dot-dxshowmessagefmt-x28-d5c2b558-x29.md

latest6.5 KB
Original Source

dxShowMessageFmt(string,Untyped[],TdxMessageDialogHyperlinkClickDelegate,TdxMessageDialogShowHyperlinkHintDelegate) Method

Opens a generic message dialog box with a formatted message and an OK button.

Declaration

delphi
procedure dxShowMessageFmt(const AMessage: string; AArguments; 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.

In addition, dxShowMessageFmt allows you to define placeholders within the message and fill these placeholders using the AArguments parameter as a source. Placeholders follow the same syntax used by the system Format function.

| | AArguments | | | 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 dxShowMessageFmt procedure to display a generic message dialog box with a formatted message and an OK button. The message box uses the Application.Title value as the title.

Code Example: Display a Generic Message Dialog with a Templated Message

The code example in this section prepares a message template string that includes %s placeholders and a source array containing two strings (as placeholder values). The demonstrated dxShowMessageFmt procedure displays a message dialog box with a message generated from the message template and the source array.

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

procedure TMyForm.DemonstrateDxShowMessageFmt1;
var
  AHelpURL, AMessage, ATitleURL: string;
begin
  // Define a formatted message template with hyperlinks (using the BBCode-inspired markup)
  AHelpURL := 'https://docs.devexpress.com/VCL/dxMessageDialog.dxShowMessageFmt(D5C2B558)';
  ATitleURL := 'https://docwiki.embarcadero.com/Libraries/en/Vcl.Forms.TApplication.Title';
  AMessage := 
    '[URL=%s]dxShowMessageFmt[/URL] displays a generic message dialog box ' +
    'with a formatted message ([B]AMessage[/B]) and an [B]OK[/B] button.' +
    sLineBreak + sLineBreak + 'The message box has no icon and uses the ' +
    '[URL=%s]Application.Title[/URL] value as the title.';

  dxShowMessageFmt(AMessage, [AHelpURL, ATitleURL]); // Displays a formatted message dialog box
end;
cpp
#include "dxMessageDialog.hpp" // Declares the dxShowMessageFmt 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::DemonstrateDxShowMessageFmt1()
{
  UnicodeString AMessage, AHelpURL, ATitleURL;

  // Define a formatted message template with hyperlinks (using the BBCode-inspired markup)
  AHelpURL = "https://docs.devexpress.com/VCL/dxMessageDialog.dxShowMessageFmt(D5C2B558)";
  ATitleURL = "https://docwiki.embarcadero.com/Libraries/en/Vcl.Forms.TApplication.Title";
  AMessage = UnicodeString(
    "[URL=%s]dxShowMessageFmt[/URL] displays a generic message dialog box "
    "with a formatted message ([B]AMessage[/B]) and an [B]OK[/B] button.") +
    sLineBreak + sLineBreak + "The message box has no icon and uses the "
    "[URL=%s]Application.Title[/URL] value as the title.";

  // Display a formatted message dialog box
  dxShowMessageFmt(AMessage, ARRAYOFCONST((AHelpURL, ATitleURL))); 
}

See Also

Message Dialog Boxes

TdxMessageDialogForm.Create Constructor

BBCode-Inspired Text Formatting Markup

dxMessageDialog Unit