The Programmer's pane is opened by default in every design element unless that element has a different design tool, as is the case with the database icon and the About and Using documents. This pane is where all code is produced for the design elements that support the database. Figure 3.10 shows the Programmer's pane.
Figure 3.10. The window title for the form is composed in the Programmer's pane. The Action pane is displayed in the upper-right corner of the Work pane.
The Programmer's pane displays the name of the design element that you are working with and the event that you are programming.
Under the name, you will notice the Run options (shown in Figure 3.11) that let you choose the type of language being used for the event. You can also choose the type of client, Web or (Notes) Client. Note that not all of the languages listed are available for each design object:
Figure 3.11. The drop-down list in the Programmer's pane for a shared action lists the available languages for a Notes client.
To write the code for an object, you must select the object and the event that should trigger the code. Then choose the client and the language that you will use, and type your code in the Programmer's pane.
You can select the object that you want to work with in two ways. The first is to click the object in the Work pane; the second is to select the object from the Object View box, shown in Figure 3.12. If you have selected the object in the Work pane, the object also is highlighted in the Object View box. Next, you must select the event associated with the object that you want to program. The events that you can program will change based on the object that you select. The list of events for any object is indented under the object name in the Object view. Clicking the plus sign next to the object expands the category so that you can see the list of available events. You can select an event by highlighting it in the Object View box.
Figure 3.12. In the Object View browser, you can select an event to program. When an event is programmed, the icon next to its name is filled.
If you are writing LotusScript, a drop-down field titled Errors is opened below the main LotusScript window. When script is saved, Notes checks for syntax errors, which then appear in this field.
From the Reference tab, you can get help by selecting an object and pressing the F1 key or clicking the Help button. You can also paste a command into the Programmer's pane by clicking the Paste button.
The Agent Design window also has a Programmer's pane. Simple actions, formulas, LotusScript, imported Java, and Java are available there as well. Agents are discussed in detail in Chapter 11, "Automating Your Application with Agents."
Take advantage of the formatting features for adding comments and for enhancing clarity. Including blank lines after comments separates them from the formulas that follow. Breaking up and indenting portions of complex formulas can significantly improve their readability, thus making code easier to conceptualize and maintain.
The sample code in Listing 3.1 illustrates the use of blank lines and indentations.
Listing 3.1 Formatting Code for Readability
REM "If the doc is not being saved, exit " ; @If(@IsDocBeingSaved ; @Success ; @Return("") ) ; REM "If the doc is new, use @Name... etc. " ; @If(@IsNewDoc cEditors = "" ; @Name([CN];@UserName) ; @Subset( (@Name([CN]; @UserName) : cEditors) ; 5) )
Setting Options for the Programmer's Pane
Of the four panes in the Designer, the Programmer's pane is the only one with its own properties. To open the Programmer's pane properties box, right-click in the Programmer's pane and choose Programmer's Pane Properties from the context menu.
The resulting properties box is shown in Figure 3.13.
Figure 3.13. The Programmer's pane includes a properties box with three tabs. The Font tab is visible in this figure.
The first tab is the Font tab (see Figure 3.13). The radio button at the top of the Font tab has three choices: Script/Java, Formulas, and Simple Actions. In Release 6, each can have its own default fonts. Except for simple actions, colors can be set for specific language elements such as keywords, errors, constants, and comments. The use of color is a very nice feature, cleanly delineating different sections of code.
The second tab is the Format tab (see Figure 3.14). On this tab you can set formatting options in the Formatting section, including Auto-Indent LotusScript and Auto-Wrap Formulas. In the Options section, you can force the Programmer's pane to add Option Declare to each Options event of LotusScript.
Figure 3.14. The Format tab of the Programmer's Pane properties box lets you control the formatting of LotusScript.
The last tab is the Auto Complete tab (see Figure 3.15). On this tab, you can optionally set Auto Complete and control whether it also autocompletes parameters. You can also set the delay in milliseconds .
Figure 3.15. The Auto Complete tab of the Programmer's Pane Properties box lets you set the behavior for autocompletion of keywords and formulas in the Programmer's pane.
Part I. Introduction to Release 6
Whats New in Release 6?
The Release 6 Object Store
The Integrated Development Environment
Part II. Foundations of Application Design
Advanced Form Design
Using Shared Resources in Domino Applications
Using the Page Designer
Adding Framesets to Domino Applications
Automating Your Application with Agents
Part III. Programming Domino Applications
Using the Formula Language
Real-World Examples Using the Formula Language
Writing LotusScript for Domino Applications
Real-World LotusScript Examples
Writing Java for Domino Applications
Real-World Java Examples
Enhancing Domino Applications for the Web
Part IV. Advanced Design Topics
Accessing Data with XML
Accessing Data with DECS and DCRs
Security and Domino Applications
Creating Workflow Applications
Analyzing Domino Applications
Part V. Appendices
Appendix A. HTML Reference
Appendix B. Domino URL Reference