Displaying Alerts and Dialog Boxes
When writing programming code to extend the functionality of a Microsoft Office InfoPath 2007 form, it is often useful to provide the user with information in a dialog box. Programmatically displaying a dialog box is accomplished in InfoPath by using the UI object.
Overview of the UI object
The UI object provides the following methods that form developers can use to display different types of dialog boxes to InfoPath users when they are filling out a form.
Name | Description |
---|---|
Alert method | Displays a simple message box that contains a specified message string |
Confirm method | Displays a message box with buttons for input from a user. The value that is returned is one of the XdConfirmChoice enumerated constants. |
SetSaveAsDialogFileName method | Sets the default file name for a form in the Save As dialog box. |
SetSaveAsDialogLocation method | Sets the initial location at which the Save As dialog starts to browse when it is opened. |
ShowMailItem method | Creates a new e-mail message in the default e-mail application, with the currently open form attached to the message |
ShowModalDialog method | Displays a modal dialog box, based on the specified .html file and positional arguments |
ShowSignatureDialog method | Displays the built-in Digital Signatures dialog box |
Using the UI object
The UI object is accessed through the UI property of the XDocument object. The following example demonstrates using the ShowMailItem and Alert methods of the UI object:
|
This example demonstrates how to use the ShowModalDialog method of the UI object to display a custom dialog box:
|
For more information about how the methods of the UI object are used, click the methods in the preceding table.