4.14 Feedback: TaskDialogs
TaskDialogs will give users quick-and-dirty visual feedback

Tools Have Audiences

When a user starts using your custom scripts, they might not know when they've finished executing or whether they ran successfully. Even a small element of visual feedback can go a long way in making your tools more usable.

Creating a TaskDialog

​TaskDialogs are Revit's API class for providing verbose user feedback. They can be executed with a single line of code, like so:
1
#Boilerplate Code
2
​
3
TaskDialog.Show("Example Title", "Example Text")
Copied!
Which causes Revit to display this dialog box:
TaskDialogs are useful to provide a level of feedback to a user - perhaps you want to report whether the script ran successfully or encountered any errors.

Customising the TaskDialog

The above example implemented a bare-minimum TaskDialog, but these can also be edited via the class' properties to make something richer, like so:
1
#Boilerplate Code
2
​
3
task_dialog = TaskDialog("Example Title")
4
task_dialog.CommonButtons = TaskDialogCommonButtons.Cancel | TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Close | TaskDialogCommonButtons.No | TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.Retry | TaskDialogCommonButtons.None
5
task_dialog.FooterText = "Example Footer Text"
6
task_dialog.MainInstruction = "Example Main Instruction"
7
task_dialog.MainContent = "This is the main content for this TaskDialog"
8
​
9
task_dialog.Show()
Copied!
Which display the following
Last modified 1yr ago
Copy link