File: inconAboutTheProgrammingEnvironment.htm

package info (click to toggle)
office2003-schemas 1.0%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 42,304 kB
  • sloc: javascript: 2,429; makefile: 29
file content (12 lines) | stat: -rw-r--r-- 11,051 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01039182"><META NAME="lcid" CONTENT="1033"><title>About the programming environment</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>About the programming environment</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>Microsoft Office InfoPath 2003 uses the <a href="#" class="glossary" onclick="AppendPopup(this,'xdmicrosoftscripteditormse')" onkeypress="AppendPopup(this,'xdmicrosoftscripteditormse')">Microsoft Script Editor (MSE)</a> as its primary integrated development  environment. Microsoft <a href="#" class="glossary" onclick="AppendPopup(this,'ofjscript')" onkeypress="AppendPopup(this,'ofjscript')">JScript</a> and Microsoft <a href="#" class="glossary" onclick="AppendPopup(this,'ofVBScript')" onkeypress="AppendPopup(this,'ofVBScript')">VBScript</a> are the programming languages that are used in MSE to create custom business logic for a form.</p><p><b>Note</b>  If you have Microsoft Visual Studio .NET 2003, you can use the Microsoft Office InfoPath 2003 Toolkit for Visual Studio .NET to create InfoPath projects using managed code. For more information on using Visual Studio .NET to create InfoPath projects, see the documentation installed with the InfoPath 2003 Toolkit for Visual Studio .NET. For information on how to download the InfoPath 2003 Toolkit for Visual Studio .NET, see the <a href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT011268791033&amp;CTT=11&amp;Origin=HV010391821033" target="_new">InfoPath Developer Page on Office Developer Center</a>. </p><p>MSE can be opened when working with a form in <a href="#" class="glossary" onclick="AppendPopup(this,'xddesignmode')" onkeypress="AppendPopup(this,'xddesignmode')">design mode</a> by <b class="ui"></b> pointing to <b class="ui">Script</b> on the <b class="ui">Tools</b> menu and clicking <b class="ui">Microsoft Script Editor</b>, or by pressing ALT+SHIFT+F11. When you open MSE from InfoPath, the MSE code editor appears and the form's default scripting file (with either a .js or .vbs extension, depending on the scripting language set for the form) opens in the code editing window.</p><p>Working with MSE in an InfoPath form involves several tasks, including setting the default scripting language, creating an event handler, and debugging scripting code.</p><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Setting the default scripting language</a></p><div id="ExpCol" class="collapsed" border="0"><p> InfoPath supports using either JScript or VBScript in a form, but you cannot mix the two programming languages in a single form. To set the default scripting language used in a form, you click <b class="ui">Form Options</b> on the <b class="ui">Tools</b> menu in design mode, and then select the scripting language in the <b class="ui">Form script language</b> list on the <b class="ui">Advanced</b> tab of the <b class="ui">Forms Options</b> dialog box.</p><p><b>Note</b>  After you have selected the default scripting language and created an event handler, you will not be able to change the scripting language used in a  form.</p></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Creating an event handler</a></p><div id="ExpCol" class="collapsed" border="0"><p>When writing scripting code in an InfoPath form, you will usually be writing code in one of the InfoPath form or data validation <a href="#" class="glossary" onclick="AppendPopup(this,'xdeventhandler')" onkeypress="AppendPopup(this,'xdeventhandler')">event handlers</a>. How you create the event handlers depends on the type of event that you want to use. It is important that you initially create the event handlers in design mode<nbsp />— InfoPath creates the declarations of the event handlers in the script file and makes entries in the <a href="#" class="glossary" onclick="AppendPopup(this,'xdformdefinitionfilexsf')" onkeypress="AppendPopup(this,'xdformdefinitionfilexsf')">form definition (.xsf) file</a> that enable a form to use the event handlers.</p><p><b>Note</b>  Although it is possible to create the event handlers manually in the script file and then manually add the appropriate elements to the .xsf file to enable them, it is not recommended.</p><p>The following table lists each of the InfoPath event handlers and the steps for creating them.</p><table><tr><th>Event handler</th><th>Steps</th></tr><tr><td>OnLoad</td><td>On the <b class="ui">Tools</b> menu, point to <b class="ui">Script</b>,  and then click <b class="ui">On Load Event</b>.</td></tr><tr><td>OnSwitchView</td><td>On the <b class="ui">Tools</b> menu, point to <b class="ui">Script</b>,  and then click <b class="ui">On Switch Views  Event</b>.</td></tr><tr><td>OnBeforeChange</td><td>In the <b class="ui">Events</b> list in the <b class="ui">Data Validation</b> dialog box (which is accessible from the <b class="ui">Data</b> tab of a control's <b class="ui">Properties</b> dialog box), click <b class="ui">OnBeforeChange</b>.<p>The OnBeforeChange event handler can also be created by clicking the <b class="ui">Validation and Script</b> tab in a field's <b class="ui">Field or Group Properties</b> dialog box, and then clicking  <b class="ui">OnBeforeChange</b> in the <b class="ui">Events</b> list.</p></td></tr><tr><td>OnValidate</td><td>In the <b class="ui">Events</b> list in the <b class="ui">Data Validation</b> dialog box (which is accessible from the <b class="ui">Data</b> tab of a control's <b class="ui">Properties</b> dialog box), click <b class="ui">OnValidate</b>.<p>The OnValidate event handler can also be created by clicking the <b class="ui">Validation and Script</b> tab in a field's <b class="ui">Field or Group Properties</b> dialog box, and then clicking <b class="ui">OnValidate</b> in the <b class="ui">Events</b> list.</p></td></tr><tr><td>OnAfterChange</td><td>In the <b class="ui">Events</b> list in the <b class="ui">Data Validation</b> dialog box (which is accessible from the <b class="ui">Data</b> tab of a control's <b class="ui">Properties</b> dialog box), click <b class="ui">OnAfterChange</b>.<p>The OnAfterChange event handler can also be created by clicking the <b class="ui">Validation and Script</b> tab in a field's <b class="ui">Field or Group Properties</b> dialog box, and then clicking <b class="ui">OnAfterChange</b> in the <b class="ui">Events</b> list.</p></td></tr><tr><td>OnSubmitRequest</td><td>On the <b class="ui">Tools</b> menu, click <b class="ui">Submitting Forms</b>. In the <b class="ui">Submitting Forms</b> dialog box, click <b class="ui">Submit using custom script</b> in the <b class="ui">Submit</b> list.</td></tr><tr><td>OnVersionUpgrade</td><td>On the <b class="ui">Tools</b> menu, click <b class="ui">Form Options</b>. In the <b class="ui">Form Options</b> dialog box, click the <b class="ui">Advanced</b> tab, and then click <b class="ui">Use script event</b> in the <b class="ui">On version upgrade</b> list.</td></tr><tr><td>OnAfterImport</td><td>This event handler cannot be created in design mode. It must instead be created manually. See the <b class="bterm"><a href="xdevtOnAfterImport.htm" id="HV01021367" lcid=" ">OnAfterImport</a></b> event for more information.</td></tr></table></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Debugging scripting code</a></p><div id="ExpCol" class="collapsed" border="0"><p>A common feature of integrated development environments is the ability to debug the code you have written. Debugging programming code involves choosing to debug when a script error occurs or setting a breakpoint in the code that tells the debugger when to suspend program execution, which allows developers to step through their code and examine its behavior.</p><p>To debug the code that is used to customize an InfoPath form, you can use a programming debug statement in your code. In JScript, use the <code>debugger;</code> statement; in VBScript, use the <code>Stop</code> statement. After you have entered a debug statement in your code, save the code and preview your  form. The following example demonstrates how to use the debug statement in the OnLoad event handler using JScript syntax:</p><pre><code>function XDocument::OnLoad(eventObj)
{
   debugger;
}</code></pre><p>When you preview or open a form that has a debug statement in it, the <b class="ui">Just-In-Time Debugging</b> dialog box appears, prompting you to select the debugger that you want to use. Click <b class="ui">New Instance of Microsoft Script Editor</b>, and then click <b class="ui">OK</b>. The <b class="ui">Step Into Remote Procedure Call</b> dialog box prompts you to select the program type that you want to debug. Click <b class="ui">Script</b>, and then click <b class="ui">OK</b>. MSE opens in debug mode and displays a yellow arrow indicating where program execution has been suspended.</p><p>With MSE in debug mode, you can use all of the debugging features that it provides, including breakpoints, stepping through program statements, and viewing any of the debugging windows such as the <b class="ui">Watch</b>, <b class="ui">Immediate</b>, and <b class="ui">Call Stack </b>windows.</p><p>To stop debugging your scripting code, click <b class="ui">Stop Debugging</b> on the <b class="ui">Debug</b> menu, or press SHIFT+F5 .</p></div><p><b>Note</b>  For more information about using MSE, click <b class="ui">Microsoft Script Editor Help</b> on the <b class="ui">Help</b> menu when working in MSE.</p><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/inconAboutTheProgrammingEnvironment_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">&copy;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&amp;CTT=11&amp;Origin=HV011232471033" 

target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>