Creating and Managing Layouts

 <  Day Day Up  >  

Creating and managing layouts is one of the most important tasks required of a FileMaker Pro developer. It's also one of the most intuitive. There are, nonetheless, numerous subtle facts and details that you need to know. We encourage you to have a test file open as you go through the following sections so you can try things firsthand.

Creating a New Layout

Every time you create a new table in a file, FileMaker automatically creates a new layout for you as well. The layout is given the same name as your table, and all the fields that you defined at the time of table creation are placed on the layout for you. Figure 4.1 shows an example of what this default layout looks like.

Figure 4.1. The default layout created when you add new tables to a file.
graphics/04fig01.gif

You can create new layouts any time you want while in Layout mode simply by choosing L ayouts, N ew Layout/Report, or by pressing ( graphics/04inl01.gif -N) [Ctrl+N]. You are then taken to a set-up wizard that can help you configure a layout according to one of a handful of types of common layout designs. Figure 4.2 shows the first screen of the Layout Wizard, on which you specify a name for the layout and choose a layout type. You also specify a layout's context here; that topic is covered in the next section.

Figure 4.2. This is the first screen of the wizard for creating new layouts.

graphics/04fig02.jpg


You can create the following six types of layouts:

  • Standard Form ” Useful for data entry layouts, Standard Form generates a basic form view layout with a set of fields you specify. You can select a theme for the layout as well; themes specify the default background color and text styles that will be applied to the layout.

  • Columnar List/Report ” As the name implies, this type is used for creating basic list and subsummary reports . If you don't already have the necessary summary fields in your database, you can create them right from within the wizard.

  • Table View ” Table view gives you a spreadsheet-like view of your data. When you select Table view as your layout type, you can select the fields you want to appear on your new layout. They are then displayed according to your selected theme in Table view. Table view is quite useful for behind-the-scenes data manipulation, but may not be suitable as an end- user interface.

  • Labels ” This type of layout is used for printing sheets of labels in standard or custom sizes. The Layout Wizard prompts you to specify the type of labels you will be using ”Avery 5160/5260 are the labels used most commonly. If you don't see your label type listed, you can specify custom measurements. See the "Multi-Column Layouts" section later in this chapter for some tips that will come in handy for working with label layouts.

  • Envelope ” You are prompted to select fields you want to use for the address portion of the envelope. The default layout is sized for standard business envelopes. You may need to do some testing and tweaking of the layout to get things just right for your envelopes and printer.

  • Blank Layout ” Choosing Blank Layout gives you just that: a completely blank layout, which you can then manipulate any way you want, free of wizards.

We do not discuss all the screens of the New Layout/Report Assistant here; they're quite intuitive, even for rookie developers. Besides, if you are new to FileMaker, nothing beats spending an hour just playing around with the assistant to see first hand what the various configuration options do for you. You won't cause harm to any existing layouts by doing so, nor can you hurt the database even if you mess up the creation of a new layout.

After a layout has been created, it can be completely modified and turned into whatever you need it to be. Much of the remainder of this chapter is devoted to the tools at your disposal to do just that.

TIP

There is no tool available for importing layouts from one file to another. If you ever need to do this, the best method is to set up a new, blank layout with parts sized the same as the source layout. Then, copy all the objects from the source file and paste them into the new file. Fields, buttons , and portals need to be respecified to point to their correct referents , but at least all your formatting will be retained.


Within a file, you can duplicate layouts by choosing L ayouts, D u plicate Layout. Often, this is a preferred method for creating new layouts, even if they end up looking significantly different from the original. Part sizes, graphic elements, and formatting options are all retained, so modifying as necessary with these as a starting point is usually much faster than creating new layouts from scratch.

TIP

Create a template layout for yourself that has examples of all the necessary bits and pieces specified (portals, fields, field labels), along with color squares and grid lines. Then you can simply duplicate your template when you need to create a new layout and you'll be well on your way to a finished product.


Layout Context

graphics/new_icon.jpg

In FileMaker Pro 7, every layout is linked to a table occurrence from the Relationships Graph. Many layouts can be linked to a particular table occurrence, but each layout must be tied to one, and only one, table occurrence.


For more information on table occurrences, see "Adding a Table Occurrence to the Relationships Graph," p. 183 .


The reason layouts need to be associated with table occurrences is because in a multi-table file, FileMaker needs some way of knowing which records to display in a given layout. In the old days when FileMaker allowed only one table per file, it was always clear that layouts in file X should display records from table X. Now, layouts in file X can be configured to display records from table A, B, or C. The context of a layout is determined by the table occurrence to which it is tied.

graphics/troubleshooting_icon.jpg

The concept of layouts being tied to table occurrences can be a bit confusing. See "Determining Which Records Will Be Displayed on a Layout" in the Troubleshooting section at the end of this chapter.


You might wonder why layouts need to be associated with table occurrences and not base tables themselves . If you were concerned only with displaying records from the base table, you wouldn't need to worry about table occurrences. But layouts also need to be able to contain records from related tables (that is, portals), and relationships are built between table occurrences, not between base tables. Having a layout linked to a table occurrence makes it unambiguous what context should be used to access related records.

When you define a new layout, the very first prompt of the New Layout/Report Assistant is for where to Show Records From. The options in the pick list are all the table occurrences from the current file's Relationships Graph. At any time, you can go into the Layout Setup dialog to see what context has been set or to change it, though this isn't advisable unless you're an experienced multi-table developer.

If you do have multiple occurrences of any of your base tables, the selection of a particular occurrence in no way affects your ability to see and/or edit field data in the base table itself. That is, if you don't intend to put any related fields on the layout, then it's likely to be inconsequential which occurrence of that base table you select. Do realize, however, that context for scripts is determined by the currently active layout, so some scripts might behave differently if one or another occurrence is used.

The implications of context for scripting are discussed elsewhere; see "Script Context and Internal Navigation," p. 253 .


Layout Setup

The Layout Setup dialog, accessed under the L ayouts menu, allows you to edit many of the fundamental characteristics of a layout, such as the name of the layout, its context, and how it can be viewed (see Figure 4.3).

Figure 4.3. The Layout Setup dialog is where you go to change things such as the name of a layout and its context.

graphics/04fig03.jpg


Layout Names

You have a great deal of flexibility in how you name layouts. Layout names do not need to be unique and can be up to 100 characters long. They can include numbers , symbols, spaces, and pretty much anything else you want to use.

Though flexibility is a good thing, we suggest you follow a few guidelines:

  • If a layout will potentially be accessed via ODBC or Custom Web Publishing, you should avoid symbols and spaces in the layout name.

  • Only the first 8 “12 characters of a layout name are visible in the layout selection pop-up (near the top of the status area). The full name is visible when a user clicks on the pop-up, but it can be helpful to use short, unique names for easy identification.

  • Try to use names that are somewhat descriptive of the purpose of the layout. Names like "List" and "Layout #3" may not convey much meaning to users.

  • In a multi-table file, consider having the base table name as part of the layout name. For instance, "Customer:Data Entry" or "Data Entry (Customer)" may be good names if you need to differentiate among multiple data entry layouts.

  • Finally, if you use a single hyphen (-) as a layout name, this appears in the layout pop-up list as a divider. Users can't select divider layouts, which merely serve to help organize what might otherwise be an unwieldy list. Typically, such layouts would be left completely blank, but this isn't a requirement.

TIP

The single hyphen naming trick works in other areas of FileMaker as well, such as within value lists and as a script name.


View Options

Every layout you develop can potentially be viewed in three different ways: as a form, as a list, or as a table. A user with access to menu commands can use the V iew menu in Browse mode to switch between them. When you navigate to a layout, you will see it in whatever state in which it was last saved, so bear in mind that switching from layout to layout may also change the view setting as well.

The differences between the three view types are quite straightforward:

  • View as Form ” This view type always shows one record at a time. Any header and footer parts are not fixed on the layout; if the layout has a long body, a user might need to scroll to see the footer. If the body part is short, the last part on the layout expands to fill the empty space. Subsummary parts are visible in Browse mode, but any summary fields in them represent summaries of all the records in the found set. The maximum height and width of a layout is just over 111 inches. For some long forms, such as legal contracts, you may need to split the form into two separate layouts.

  • View as List ” With View as List, the number of records displayed is determined by the height of the layout body part and the height of the window. If more records are present in the found set than can be displayed on screen, the vertical scroll bar enables users to see additional records. Any header and footer parts are fixed on screen at all times, even when a user scrolls to see additional records. Subsummary parts are never visible in Browse mode with View as List. If fields are placed in the header or footer parts, they take their values from the currently active record. Any modification to a field in the header or footer part likewise affects the currently active record.

  • View as Table ” In Table view, all the fields in the layout's body are presented in a spreadsheet-like grid. The initial order of the fields is determined by their top-to-bottom position on the layout. That is, the first column is the top-most field on the layout. No non-field elements (for example, buttons, text, graphics) from the body of the layout are rendered in Table view. Field formatting (for example, color, font, font size , and so on) is honored, however. Oddly, the column headers conform to the format of the first field. Other properties of the Table view can be specified under the Views tab of the Layout Setup dialog. As shown in Figure 4.4, you can specify whether header and footer parts should be visible and whether columns can be sorted, reordered, and resized.

    Figure 4.4. You can alter the look and functionality of the table view by using the Table View Properties dialog.

    graphics/04fig04.jpg


Using the Views tab of the Layout Setup dialog, you can disable user access to certain view types. Although usually not necessary, this can be a good precaution to take to keep adventurous users on the right track. Accessing an inappropriate view type is likely not going to cause much harm, but it certainly can confuse users.

Multi-Column Layouts

When printing labels and certain types of reports, you might want to present your data in multiple columns. You can specify the number of columns to display on the Printing tab of the Layout Setup dialog; this is shown in Figure 4.5.

Figure 4.5. You can customize the print settings for a particular layout on the Print tab of the Layout Settings dialog.

graphics/04fig05.jpg


In Layout mode, dashed vertical lines represent the boundaries between columns. Columns other than the first are grayed out; the idea is that you need to place any objects you want displayed in the first column, and these objects are replicated to the other columns as necessary. Figure 4.6 shows an example of a 3-column layout used to display a phone directory. Notice that the header and footer part are not divided into columns. This means that if you want headers to appear above the second and third columns, you need to add those explicitly, as we've done in Figure 4.6.

Figure 4.6. This example shows how a layout for a 3-column phone directory might appear in Layout mode.
graphics/04fig06.gif

It's not possible to have columns of differing widths; every column is the same width as the first one. You can manually adjust the column width by clicking on the dashed divider between the first and second column and dragging left or right as appropriate.

Subsummary parts and leading and trailing grand summaries can be used on multi-column layouts, but they behave slightly differently depending on whether you've chosen to display data Across First or Down First. If you chose Down First, then any summary parts are also columnar. On the other hand, if the data is displayed Across First, then summary parts span the full width of the layout, just as the header and footer parts do.

Subsummary parts are covered in depth in "Working with Parts," p. 99 .


The effects of a multi-column layout can be viewed only in Preview mode. In Browse mode, a user sees only a single column of data.

Hiding and Reordering Layouts

In Browse mode, layouts can be either accessible or inaccessible via the layout pull-down menu in the status area. If a layout is accessible, users can see it and navigate to it at will. If it is inaccessible, users can navigate to it only by running a script that takes them there. In Layout mode, all layouts are accessible.

Typically, layouts are set to be inaccessible when you need to prevent users from manually navigating to a layout. For instance, you might have report layouts or find screens that require certain preparation before they become useful. There may be unanticipated and/or undesired results if a user is able to bypass the scripts you've created and navigate directly to a layout.

The option to have a layout be accessible or not is on the first screen of the New Layout/Report Assistant; it can also be set through the Layout Setup dialog. The Set Layout Order dialog, shown in Figure 4.7, also has a check box on each line that can be toggled to change a layout from visible to hidden and vice versa. Using this method is the quickest way to hide (or show) a number of layouts at once.

Figure 4.7. Use the Set Layout Order dialog to set the accessibility and order of layouts.

graphics/04fig07.gif


The Set Layout Order dialog, as you might guess from its name, also enables you to change the order in which layouts appear in the layout pop-up list. You can use the double-arrowed selection tool to move a layout up or down in the order. You can accomplish the same thing by selecting a line and pressing ( graphics/04inl01.gif ) [Ctrl] and either the up or down arrow.

NOTE

graphics/new_icon.jpg

In previous versions of FileMaker, you were required to be the host of a file to access the Set Layout Order dialog. It can now be managed even as a client of FileMaker Server.


Restricting Access to Layouts

Using the methods discussed in the previous section to hide layouts is a good way of keeping users from going places they shouldn't, but it's not adequate security if you truly need to restrict access to layouts. Plus, making layouts inaccessible affects all users; you can't set up rules for which layouts are accessible for which users.

Added protection for layouts can be achieved by restricting access via privilege sets. A privilege set can be defined to provide either All No Access, All View Only, or All Modifiable control over layouts. Alternatively, you can specify custom layout privileges, as shown in Figure 4.8. You can protect both editing the layouts themselves as well as the data displayed on them. Any user who has no access to a layout, doesn't see that the layout exists, even in Layout mode.

Figure 4.8. Custom Layout Privileges enable you to restrict certain users from modifying or viewing certain layouts.

graphics/04fig08.jpg


For more information about setting up privilege sets, see "Privilege Sets," p. 325 .


If you want to prevent certain users from creating new layouts, leave the Allow Creation of New Layouts option at the top of the Custom Layout Privileges dialog unchecked. Additionally, you can set default privileges that users will have for new layouts by editing the options for the [Any New Layout] line.

 <  Day Day Up  >  


QUE CORPORATION - Using Filemaker pro X
QUE CORPORATION - Using Filemaker pro X
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 494

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