Description
This example shows how the new Vista task dialogs can be displayed, both using routines in the Dialogs unit or by instantiating the TCustomTaskDialog class.
Code
procedure TForm1.FormCreate(Sender: TObject);
var
TaskDialog: TTaskDialog;
Button: TTaskDialogBaseButtonItem;
begin
// display a task message dialog at a certain position
TaskMessageDlgPos('Continue', 'Are you sure you want to continue?', mtWarning, mbYesNoCancel, 0, 10, 10);
// display another message dialog at the current position
TaskMessageDlg('Error', 'An error has occured', mtError, mbAbortRetryIgnore, 0);
// create a custom task dialog
TaskDialog := TTaskDialog.Create(Self);
TaskDialog.Title := 'An error has occured in the query.';
TaskDialog.Caption := 'Query result';
// assign a MB_OK modal result to the task dialog
TaskDialog.ModalResult := MB_OK;
// add some customized buttons to the task dialog
Button := TaskDialog.Buttons.Add;
Button.Caption := 'Continue';
Button.ModalResult := MB_OK;
Button := TaskDialog.Buttons.Add;
Button.Caption := 'Retry';
Button.ModalResult := MB_RETRYCANCEL;
// display the dialog box
TaskDialog.Execute;
end;
Uses
- Vcl.Dialogs.TTaskDialogBaseButtonItem ( fr | de | ja )
- Vcl.Dialogs.TCustomTaskDialog ( fr | de | ja )
- Vcl.Dialogs.TCustomTaskDialog.ModalResult ( fr | de | ja )
- Vcl.Dialogs.TTaskDialogBaseButtonItem.ModalResult ( fr | de | ja )
- Vcl.Dialogs.TaskMessageDlg ( fr | de | ja )
- Vcl.Dialogs.TaskMessageDlgPos ( fr | de | ja )