[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Implements a widgetset-independent dialog similar to QuestionDlg.
Source position: dialogs.pp line 727
function DefaultQuestionDialog( |
const aCaption: string; |
const aMsg: string; |
DlgType: LongInt; |
Buttons: TDialogButtons; |
HelpCtx: LongInt |
):LongInt; |
aCaption |
|
Title text of the dialog form |
aMsg |
|
Message text displayed in the dialog form. |
DlgType |
|
A number to select the icon shown in the dialog. Select one of the idDialogXXXX constants declared in the unit LCLType (idDialogWarning, idDialogError, idDialogInfo, idDialogConfirm or idDialogShield). Do not use the TMsgDlgType values which are used by other dialogs! |
Buttons |
|
A collection of button definitions with caption, return value when clicked, and boolean flags to identify the default and cancel button. |
HelpCtx |
|
HelpCtx specifies the help topic that should be shown when F1 is pressed. |
Returns the number value associated with each button.
DefaultQuestionDialog displays a message dialog, similar to QuestionDlg, but it uses a LCL TForm instance instead of relying on dialogs provided by the operating system. The content displayed on the dialog form is specified by the arguments passed to the routine, including:
Example
Since Buttons is a TCollection each item must be added individually:
var btns: TDialogButtons; // requires "uses InterfaceBase" res: Integer; ... btns := TDialogButtons.Create(TDialogButton); with btns.Add do begin Caption := 'OK'; ModalResult := mrOK; end; with btns.Add do begin Caption := 'Cancel now'; ModalResult := mrCancel; end; with btns.Add do begin Caption := 'Ignore'; ModalResult := mrIgnore; end; with btns.Add do begin Caption := 'Do it'; ModalResult := 300; Default := true; end; res := DefaultQuestionDialog('This is the caption', 'This is the title', idDialogError, btns, 0);
This code will display a dialog box with the following four buttons:
Version 3.2 | Generated 2024-02-25 | Home |