TaskDialogs (C++)
Description
This example shows how the new Vista task dialogs can be displayed, both using routines in the Dialogs namespace or by instantiating the TCustomTaskDialog class.
Code
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
// 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
TTaskDialog *taskDialog = new TTaskDialog(this);
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
TTaskDialogBaseButtonItem *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();
}
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 )