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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01021416"><META NAME="lcid" CONTENT="1033"><title>ShowModalDialog Method</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>ShowModalDialog Method</h1><DIV class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="appliesto" onclick="toggleList()" onkeypress="toggleList()"></span><a class="ofvbanavex" href="#example"><span class="ofvbanavreuse" id="example"></span></a><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></DIV><p>
<p>Displays a custom modal dialog box in a Microsoft Office InfoPath 2003 form.</p>
<p class="signature"><i>expression</i>.<b class="bterm">ShowModalDialog</b>(ByVal <b class="bterm"><i>bstrName</i></b> As String, [ByVal <b class="bterm"><i>varArguments</i></b> As Variant], [ByVal <b class="bterm"><i>varHeight</i></b> As Variant], [ByVal <b class="bterm"><i>varWidth</i></b> As Variant], [ByVal <b class="bterm"><i>varTop</i></b> As Variant], [ByVal <b class="bterm"><i>varLeft</i></b> As Variant]) As Variant</p>
<p><i>expression </i> Required. An expression that returns a reference to the <b class="bterm"><a href="xdobjUI.htm" id="HV01021247" lcid=" ">UI</a></b> object.</p><p>
<b class="bterm">
<i>bstrName</i>
</b>Required <b class="bterm">String</b>. The name of the <a href="#" class="glossary" onclick="AppendPopup(this,'ofhtml')" onkeypress="AppendPopup(this,'ofhtml')">.html</a> file used for the modal dialog box.</p>
<p>
<b class="bterm">
<i>varArguments</i>
</b>Optional <b class="bterm">Variant</b>. Specifies the arguments to use when displaying the modal dialog box. Can be any type of value, including an array of values.</p>
<p>
<b class="bterm">
<i>varHeight</i>
</b>Optional <b class="bterm">Variant</b>. Sets the height of the modal dialog box.</p>
<p>
<b class="bterm">
<i>varWidth</i>
</b>Optional <b class="bterm">Variant</b>. Sets the width of the modal dialog box.</p>
<p>
<b class="bterm">
<i>varTop</i>
</b>Optional <b class="bterm">Variant</b>. Sets the top position of the modal dialog box relative to the upper left corner of the desktop.</p>
<p>
<b class="bterm">
<i>varLeft</i>
</b>Optional <b class="bterm">Variant</b>. Sets the left position of the modal dialog box relative to the upper left corner of the desktop.</p>
<p><i>returns </i> <b class="bterm">Variant</b>.</p>
</p><h2>Security Level</h2><p>3: Can be accessed only by fully trusted forms.</p><h2>Remarks</h2><p>
<p>The <b class="bterm">ShowModalDialog</b> method of the <b class="bterm">UI</b> object allows you to display custom dialog boxes to users as they fill out a fully trusted form. Custom dialog boxes are implemented as .html files created in any type of HTML editor, such as Microsoft FrontPage. You can use scripting code in a custom dialog box that interacts with the InfoPath object model if you pass objects to the custom dialog box using the <b class="bterm"><i>varArguments</i></b> parameter.</p>
<p>To use a custom dialog box in an InfoPath form, you must first add the .html file of the custom dialog box to the form's set of resource files by using the <b class="ui">Resource Manager</b> dialog box. The <b class="ui">Resource Manager</b> dialog box is available from the <b class="ui">Tools</b> menu in <a href="#" class="glossary" onclick="AppendPopup(this,'xddesignmode')" onkeypress="AppendPopup(this,'xddesignmode')">design mode</a>. After you have added the custom dialog box file to the form, you can use the <b class="bterm">ShowModalDialog</b> method to display it.</p></p><p><b>Note</b> Although the <b class="bterm">ShowModalDialog</b> method can only be used in fully trusted forms, you can create a custom dialog box in standard forms using the <b class="bterm">showModalDialog</b> method of the <a href="#" class="glossary" onclick="AppendPopup(this,'IDH_ofdefDynamicHTML')" onkeypress="AppendPopup(this,'IDH_ofdefDynamicHTML')">Dynamic HTML (DHTML)</a> object model.</p><h2><a id="#example" name="#example">Example</a></h2><p>
<p>In the following example, the <b class="bterm">ShowModalDialog</b> method of the <b class="bterm">UI</b> object is used to display a custom dialog box. Note that the <b class="bterm"><a href="xdobjXDocument.htm" id="HV01021254" lcid=" ">XDocument</a></b> object is passed to the custom dialog box using the <b class="bterm"><i>varArguments</i></b> parameter.</p>
<pre><code>XDocument.UI.<b class="bterm">ShowModalDialog</b>("SimpleDialog.htm", XDocument);</code></pre>
</p><p>The following example is the HTML code used to implement a simple custom dialog box. Note the use of the <b class="bterm">dialogArguments</b> property of the DHTML <b class="bterm">window</b> object to get the values passed to the custom dialog box, which in this case is the <b class="bterm">XDocument</b> object of the InfoPath object model, from the <b class="bterm">ShowModalDialog</b> method. When a user clicks the <b class="ui">Show Alert</b> button in the custom dialog box, the source XML of the form's underlying XML document appears in a message box.</p><pre><code><html>
<head>
<script language="jscript">
var gobjXDocument = null;
function Initialize()
{
// Save a reference to the XDocument object.
if (typeof window.dialogArguments == "object")
gobjXDocument = window.dialogArguments;
}
</script>
<title>A Simple Custom Dialog Box</title>
</head>
<body style="BACKGROUND-COLOR: window" onLoad="Initialize()">
<strong>Click one of the following buttons:</strong>
<br/>
<br/>
<div id="divButtons" tyle="align:center">
<input id="btnShowAlert" style="WIDTH: 106px; HEIGHT: 24px"
onclick='gobjXDocument.UI.Alert(gobjXDocument.DOM.xml);'
type="button" size="21" value="Show Alert"></input>
<input id="btnCancel" style="WIDTH: 106px; HEIGHT: 24px"
onclick="window.close();" type="button" size="21"
value="Cancel"></input>
</div>
</body>
</html></code></pre><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/xdmthShowModalDialog_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>
|