Add icon to user message

Hi there,

Is there any option to add an icon on the user message? something like this:

image

this example is for Excel, however, I would image there is something similar for Dynamo python,

At the moment I am using this code:

import clr
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import TaskDialog, TaskDialogCommonButtons, TaskDialogResult, TaskDialogCommandLinkId

mainDialog = TaskDialog("bla bla bla")
mainDialog.MainInstruction = "bla bla bla "
mainDialog.MainContent = """bla bla bla"""



mainDialog.CommonButtons = TaskDialogCommonButtons.Close;
mainDialog.DefaultButton = TaskDialogResult.Close;

mainDialog.FooterText = "bla bla bla"

tResult = mainDialog.Show()
OUT = tResult

Many thanks in advance!

Jose

This link has a ton of information regarding the TaskDialog class in the Revit API.


With that in mind we can use the logic there to access the built-in message box icons.
image

Resulting in:

and the new python code:

import clr
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import TaskDialog, TaskDialogCommonButtons, TaskDialogResult, TaskDialogCommandLinkId, TaskDialogIcon

mainDialog = TaskDialog("bla bla bla")
mainDialog.MainInstruction = "bla bla bla "
mainDialog.MainContent = """bla bla bla"""

mainDialog.MainIcon = TaskDialogIcon.TaskDialogIconShield

mainDialog.CommonButtons = TaskDialogCommonButtons.Close;
mainDialog.DefaultButton = TaskDialogResult.Close;

mainDialog.FooterText = "bla bla bla"

tResult = mainDialog.Show()
OUT = tResult
6 Likes