Revit provides a few different user forms, at least three, from experiments done so far. One is the TaskDialog kind that we have talked about before. It has an identifier property named Id. Another is the DialogBox kind as indicated by the DialogBoxShowing event. It also has an identifier property, HelpId. The third kind does not look like the TaskDialog at all and cannot be captured by the DialogBoxShowing even either.
Revit Parameter Organizer can organize various Revit parameters such as Shared Parameters, Family Parameters, Project Parameters and Built-in Parameter in many good ways.
This article will discuss all these in detail and demonstrate with code examples.
Are the TaskDialog and the DialogBox totally different?
No, they are not. Both of them can be captured by the DialogBoxShowing event. For example, we have the following code to create a TaskDialog:
TaskDialog td = new TaskDialog("Test");
td.Id = "10001";
td.MainInstruction = "TaskDialog Id Test!";
td.Show();
If the following handler of the event DialogBoxShowing is registered property:
public static void UIAppEvent_DialogBoxShowing_Handler(Object sender, EventArgs args)
{
Autodesk.Revit.ApplicationServices.Application app = sender as Autodesk.Revit.ApplicationServices.Application;
UIApplication uiApp = new UIApplication(app);
DialogBoxShowingEventArgs specArgs = args as DialogBoxShowingEventArgs;
MessageBox.Show(string.Format("HelpId: {0}", specArgs.HelpId), "Test");
}
A kind reminder: Please do not use TaskDialog in the DialogBoxShowing event. Otherwise reentry would occur.
Just before the TaskDialog shows up, a message box will appear and say what HelpId of the TaskDialog is. The same will happen to any other third party TaskDialogs and Revit native ones.
But another question may just rise up.
What does the message box really report?
The HelpId held by the DialogBoxShowingEventArgs in the DialogBoxShowing event handler in this case is -1 rather than the 10001 people may expect!
So it is clear that this HelpId of the DialogBoxShowingEventArgs is not that Id of the TaskDialog. Another clue is that their types are different, one is string and the other is int.
Ok. Then another question: Is there a way to assign the HelpId of TaskDialogs?
No. Not only for third party TaskDialogs but also for native ones which can be verified from the fact that the same DialogBoxShowingEventArgs in the same DialogBoxShowing even handler also reports -1 for native TaskDialogs.
What may be the third kind of forms then? How does the DialogBoxShowing event handle them?
The third kind include some very standard forms or dialogs such as the Open dialog and the Print dialog and also include some Revit special dialogs like the Show History. The DialogBoxShowing event does not care for them at all, i.e. skip them.
Does the HelpId -1 an indicator for TaskDialogs regardless native or custom?
Not really. Some non-TaskDialog forms such as Object Styles and Manage Links also report HelpId -1.
Is there a comprehensive list anywhere for DialogBox and HelpId?
No, not something I am aware of. HelpIds of a few forms have been found through some experiments and been appended below for reference:
DialogBox HelpId
=========================================
New 1031
DWF Publish Settings 1356
Worksets/Worksharing 1054
Restore Backup 1128
Edit Shared Parameters 1077
Project Units 1008
Materials 1176
Project Information 1002
Object Styles -1
Manage Links -1
TaskDialog like -1
Open N/A
Print N/A
Show History N/A
Instance of linked .rvt file needs Coordination Review 1011
These will be taken into account by various wizards and coders of RevitAddinWizard when necessary.
Our Software http://netspiderstudio.com/Software.html
Support: mailto:support@netspiderstudio.com
Query: mailto:info@netspiderstudio.com
More: http://netspiderstudio.com
You can add "Instance of linked .rvt file needs Coordination Review" to this list with HelpId 1011. I haven't figured out the correct DialogResult for it though.
Posted by: Matt Brown | 11/13/2013 at 11:40 AM
Matt, thanks for providing this. Added it to the list.
Posted by: Spiderinnet | 11/13/2013 at 12:33 PM