From RAD Studio API Documentation
Jump to: navigation, search


function Execute(ParentWnd: HWND): Boolean; override;


virtual bool __fastcall Execute(HWND ParentWnd)/* overload */;
inline bool __fastcall  Execute(){ return TCommonDialog::Execute(); }


Type Visibility Source Unit Parent
function public
Vcl.Dialogs TFontDialog


Displays the Font dialog.

Execute opens the Font dialog, returning true when the user selects a font and clicks OK. If the user clicks Cancel, Execute returns false.

The code signatures of Execute that appear above are actually overrides of the Execute overloads in the base class Vcl.Dialogs.TCommonDialog.Execute. There is one more overload of Execute for Delphi that appears in the inherited members from TCommonDialog, and this overload takes no input parameters.

The ParentWnd parameter is a window handle of type HWND MSDN. If none is provided, the current form handle is used, accessed from Vcl.Forms.TApplication.ActiveFormHandle in the global variable Vcl.Forms.Application.

 // Delphi:
 FontDialog1.Font := Form1.Font;
 if FontDialog1.Execute then
   for i := 0 to (Form1.ControlCount - 1) do
     if (Form1.Controls[i] is TButton) then
       (Form1.Controls[i] as TButton).Font :=
 // C++:
 FontDialog1->Font = Form1->Font;
 if (FontDialog1->Execute())
   Button1->Font = FontDialog1->Font;

See Also

Code Examples