Using Layout Regions

Layout regions were introduced in R4 of Notes and provide a means to add elements to Notes forms and subforms that are not otherwise available. Layout regions also have more display options than regular forms. These options enable the designer to create a more typical Windows GUI interface. Layout regions are fixed in size and can be added to both forms and subforms by choosing Create, Layout Region, New Layout Region from the menu. Layout regions can contain fields of all types except rich text. You can also add graphics, static text, graphic buttons , pushbuttons, and more to layout regions. Layout regions can be transparent on the form or can be 3D. By default, layout regions have a border, but you can turn off the border.

Essentially, a layout region is an enhanced section on a form. A typical use of a form with a layout region is to create refined data input screens for use with @DialogBox .

There are some drawbacks to using layout regions. First and possibly foremost, layout regions are not supported on the Web. Second, the design interface in layout regions is somewhat crude in comparison to other Windows application-development systems. For example, there are no alignment tools. You cannot select a group of objects and click an icon or make a choice from the menu that aligns the objects on center or on the bottom, top, or sides. When new objects are added, by default they appear in the center of the layout region and must be moved. Moving and aligning static text and fields is problematic . Last, rich-text fields cannot be used and layout regions cannot contain subforms or shared fields.

Working with layout regions is different from working with standard form areas. The default size for a layout region is 6" x 1.5" starting at a 1" margin. It is transparent and has a border. After the layout region is created and the cursor is in the layout region, the toolbar changes and several new icons are added: Create TextBox, Create Hotspot Button, Create Graphic Button, Design Bring to Front, and Design Send to Back. In addition, three prompts are available from the Create, Layout Region submenu: Text, Graphic, and Graphic Button.

Fields are added by clicking the Create Field SmartIcon or from the menu. Fields are called controls and are added in the center of the region.

Text cannot be added as you would do in a standard form area by simply typing in text, but they must be added from the menu by choosing Create, Layout Region, Text or by clicking the Create Textbox icon. As with fields, the text box is initially placed in the center of the layout region and must be moved.

A Graphic button is similar to a hotspot ”you can copy a graphic image to the Clipboard and paste it onto a layout region. You can then program the button. In layout regions, you can stack images and other objects on top of each other. You can control the order of their appearance with the Design Bring to Front and Design Send to Back buttons.

Using the Layout Region Properties Box

As you would expect, layout regions and all objects in a layout region have properties boxes. The Layout Region properties box is shown in Figure 5.44. There are two tabs: Layout Info and Layout Hide When. The Layout Hide When tab (not shown) is exactly like any other Hide When tab.

Figure 5.44. The properties box of a layout region has two tabs: Layout Info and Hide When.

graphics/05fig44.jpg

The style and size of the layout region can be modified on the Layout Info tab. There are three sections: Position, Display, and Grid. The size can be changed in the Position section by typing in new values or by dragging one of the grab handles (small square boxes at the corners and sides of the region) and resizing the region. The Display options are Show Border, 3D Style, and Don't Wrap Text Around Region. The Grid section has check boxes for Show Grid and Snap to Grid. The default Grid size is .050" and can be changed. The grid control features are ones that you might be familiar with from other Windows applications. Turning on the grid displays a background of dots to help align controls. Snap to Grid aligns all objects in the layout region with the grid.

Using Layout Regions with Dialog Boxes

Possibly the best use of layout regions is with @DialogBox . @DialogBox displays the form (or subform) specified in a dialog box. @DialogBox displays the first layout region on the form, if one is available. The syntax of @DialogBox is as follows :

@DialogBox( form ; [AutoHorzFit] : [AutoVertFit] : [NoCancel] : [NoNewFields] :
graphics/ccc.gif
[NoFieldUpdate] : [ReadOnly] ;

graphics/ccc.gif
SizeToTable

;

NoOkCancel

; title )

The contents of fields that have the same names in the underlying form and the form used with @DialogBox are transferred to the underlying form if the user presses the OK button. @DialogBox returns a 1 if OK is pressed and a if Cancel is pressed. Figure 5.45 illustrates the appearance of the dialog box.

Figure 5.45. This dialog box displays the history of a document.

graphics/05fig45.jpg

TIP

You can also place a layout region on a subform and call it using @DialogBox or the LotusScript DialogBox method.

 

The same dialog box can be called from LotusScript using the DialogBox method. A sample script is the following:

Sub Click(Source As Button) 
 Dim uiWorkspace As New NotesUIWorkspace
 Dim uiDoc As NotesUIDocument
 Set uiDoc = uiWorkspace.CurrentDocument
 Call uidoc.FieldSetText("StartTime","")
 Call uidoc.FieldSetText("EndTime","")
 Call uidoc.FieldSetText("Appointment","")
 Call uidoc.FieldSetText("ReturnValue","")
 Call uidoc.Refresh

 If UIWorkspace.Dialogbox("AP",True,True) Then
 Call uiDoc.Refresh
 If uidoc.FieldGetText("ReturnValue") > "" Then
 Call uiDoc.FieldAppendText("MtgDay_1",uidoc.FieldGetText ("ReturnValue") &Chr(10))
 End If
 End If
 Call uiDoc.Refresh
End Sub

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

Forms Design

Advanced Form Design

Designing Views

Using Shared Resources in Domino Applications

Using the Page Designer

Creating Outlines

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 JavaScript for Domino Applications

Real-World JavaScript 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



Lotus Notes and Domino 6 Development
Lotus Notes and Domino 6 Development (2nd Edition)
ISBN: 0672325020
EAN: 2147483647
Year: 2005
Pages: 288

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net