1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01039913"><META NAME="lcid" CONTENT="1033"><title>Displaying alerts and dialog boxes</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>Displaying alerts and dialog boxes</h1><div class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></div><p>When writing programming code to extend the functionality of a Microsoft Office InfoPath 2003 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 <b class="bterm"><a href="xdobjUI.htm" id="HV01021247" lcid=" ">UI</a></b> object.</p><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Overview of the UI object</a></p><div id="ExpCol" class="collapsed" border="0"><p>The <b class="bterm">UI</b> 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.</p><table><tr><th>Name</th><th>Description</th></tr><tr><td><b class="bterm"><a href="xdmthAlert.htm" id="HV01021376" lcid=" ">Alert</a></b> method</td><td>Displays a simple message box that contains a specified message string</td></tr><tr><td><b class="bterm"><a href="xdmthConfirm_HV01103972.htm" id="HV01103972" lcid=" ">Confirm</a></b> method</td><td>Displays a message box with buttons for input from a user. The value that is returned is one of the <b class="bterm"><a href="xdenmXdConfirmChoice_HV01104062.htm" id="HV01104062" lcid=" ">XdConfirmChoice</a></b> enumerated constants.</td></tr><tr><td><b class="bterm"><a href="xdmthSetSaveAsDialogFileName_HV01103987.htm" id="HV01103987" lcid=" ">SetSaveAsDialogFileName</a></b> method</td><td>Sets the default file name for a form in the <b class="bterm">Save As</b> dialog box.</td></tr><tr><td><b class="bterm"><a href="xdmthSetSaveAsDialogLocation_HV01103988.htm" id="HV01103988" lcid=" ">SetSaveAsDialogLocation</a></b> method</td><td>Sets the initial location at which the <b class="bterm">Save As</b> dialog starts to browse when it is opened.</td></tr><tr><td><b class="bterm"><a href="xdmthShowMailItem.htm" id="HV01021415" lcid=" ">ShowMailItem</a></b> method</td><td>Creates a new e-mail message in the default e-mail application, with the currently open form attached to the message</td></tr><tr><td><b class="bterm"><a href="xdmthShowModalDialog.htm" id="HV01021416" lcid=" ">ShowModalDialog</a></b> method</td><td>Displays a modal dialog box, based on the specified .html file and positional arguments</td></tr><tr><td><b class="bterm"><a href="xdmthShowSignatureDialog.htm" id="HV01021417" lcid=" ">ShowSignatureDialog</a></b> method</td><td>Displays the built-in <b class="ui">Digital Signatures</b> dialog box</td></tr></table></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Using the UI object</a></p><div id="ExpCol" class="collapsed" border="0"><p>The <b class="bterm">UI</b> object is accessed through the <b class="bterm"><a href="xdproUI.htm" id="HV01021347" lcid=" ">UI</a></b> property of the <b class="bterm"><a href="xdobjXDocument.htm" id="HV01021254" lcid=" ">XDocument</a></b> object. The following example demonstrates using the <b class="bterm">ShowMailItem</b> and <b class="bterm">Alert</b> methods of the <b class="bterm">UI</b> object:</p><pre><code>XDocument.UI.ShowMailItem("someone@example.com", "", "",
"Updated Form", "Here is the updated form that you requested.");
XDocument.UI.Alert("The e-mail message has been sent.");</code></pre><p>This example demonstrates how to use the <b class="bterm">ShowModalDialog</b> method of the <b class="bterm">UI</b> object to display a custom dialog box:</p><pre><code>function Import()
{
// Show a modal dialog with a size of 400x600 and using Import.htm for
// its contents. The XDocument object is passed as a dialog parameter
// and the number of CDs which were imported is returned.
var intImported = XDocument.UI.ShowModalDialog("Import.htm",
XDocument, 400, 600);
// Display how many CDs were imported.
if (intImported > 1)
XDocument.UI.Alert(intImported + " CDs were imported.");
else if (intImported == 1)
XDocument.UI.Alert(intImported + " CD was imported.");
}</code></pre><p>For more information about how the methods of the <b class="bterm">UI</b> object are used, click the methods in the preceding table.</p></div><script type="text/javascript" language="JScript" src="ofvbanl.js"></script><span id="ofVBAISpan" class="ofvbaispan"><iframe id="ofVBAIFrame" frameborder="0" marginheight="0" marginwidth="4" scrolling="auto" width="100%" src="../links/inconDisplayingAlertsAndDialogBoxes_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">©2003-2004 Microsoft Corporation. All rights reserved.</a>
Permission to copy, display and distribute this document is available at: <a
href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|