Chapter 4. Working with Layouts

In this chapter

What’s a Layout?

Creating and Managing Layouts

Working with Parts

Working with Objects on a Layout

Working with the Tab Control Object

Working with Fields

Tooltips

Troubleshooting

FileMaker Extra: Designing Cross-Platform–Friendly Layouts

What’s a Layout?

In the preceding chapter, we discussed how to define fields for holding the data you want to store in your database. In this chapter, we will discuss the tools at your disposal for creating user interfaces to manage that data.

You use layouts to create user interfaces in FileMaker Pro. A layout is a collection of graphical objects that a user interacts with to view and modify data. These objects include things such as fields, buttons, static text blocks, graphic elements (such as lines or rectangles), and images. And, beginning with FileMaker Pro 8.5, a web viewer object joins the ranks. FileMaker Pro contains a rich set of tools for manipulating these objects, allowing you to create attractive and functional interfaces for your users easily.

You can create many kinds of layouts in FileMaker. Form layouts are useful for data entry; often form layouts are shown as forms using the View as Form command from the View menu with a single record’s form shown at a time. List layouts are often used for reports and can contain summary parts; such layouts are often viewed in Preview mode from which they are printed. List layouts are also created to be viewed as a list so that many records can be viewed at a time. Such list layouts generally have navigation tools to allow you to switch with a single mouse click to a Form view with more details for an individual record, and Form views often contain a button to let you switch to a multirecord list view.

Some layouts might be designed for system administrators to clean up data quickly with a minimum of interface elements and a maximum of data. Such layouts might also allow access to fields otherwise not shown on a layout or that do not allow entry on standard layouts. Still others can serve as user navigation menus and contain no data at all.

One of the things that makes FileMaker different from database products such as MySQL, SQLite, and databases such as Oracle, DB2, and SQL Server is that the layouts themselves are stored in the database file, along with data, scripts, access privileges, and other elements of application logic. Every FileMaker Pro file must have at least one layout; there is no practical limit to the number of layouts a file can contain. It’s neither unheard of, nor undesirable, to have anywhere from a dozen to a hundred or more layouts in a file.

Layouts are created and managed in Layout mode. To get to Layout mode, choose View, Layout Mode, or simply press (image-L) [Ctrl+L]. Almost all the material in this chapter deals with tools and functions that require you to be in Layout mode to access them, but for simplicity and brevity, we will not specifically mention that fact in conjunction with every tool and tip.

In this chapter, we take a top-down approach to learning about layouts. We begin by discussing layout creation and layout configuration options. We then move down to the level of the part, and finally down to the level of objects. Learning about layouts can entail “chicken and egg” problems: Most topics intertwine to the extent that there’s no convenient linear approach through the material. We therefore encourage you to skip around from topic to topic as necessary to fill out your knowledge.

This chapter provides an introduction to the design and creation of FileMaker Pro layouts. When you create a database and its fields, FileMaker Pro creates a default layout for you; each field is added to the layout as you create it, along with a label providing the field’s name. If you update the fields in the database while a layout based on the table you are updating is open, the fields you create will be added to that layout. If you are updating the database while the current layout is based on another table, no fields are added. Similarly, if you remove fields from tables, they are removed from all layouts on which they appear. If you were to create the Contact Management Starter Solution from scratch, rather than from the Starter Solution, the default layout would appear as it does in Figure 4.1.

Figure 4.1. FileMaker Pro creates a default layout as you build your database.

image

The Contact Management Starter Solution contains a comparable layout to provide a form view (single record view) of contacts. That layout is shown in Figure 4.2.

Figure 4.2. FileMaker Pro lets you build a sophisticated layout for your data.

image

This chapter will show you the basics of moving from Figure 4.1 to Figure 4.2. Some of the details are provided later in the book.


Note

Databases accessed via Custom Web Publishing use interfaces other than FileMaker Pro layouts.


image For more information on creating FileMaker Pro interfaces, see Part III, “Developer Techniques,” p. 349.

Creating and Managing Layouts

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

Creating a New Layout

You can create new layouts anytime you want while in Layout mode simply by choosing Layouts, New Layout/Report, or by pressing (image-N) [Ctrl+N]. You are taken to a setup wizard that can help you configure a layout according to one of a handful of types of common layout designs. Figure 4.3 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; the next section covers that topic.

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

image

You can create the following seven types of layouts. As you make your selection on the first screen, schematic diagrams of the various layouts appear at the right of the dialog.

  • 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 its 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 displayed in Table view according to your selected theme. Table view is quite useful for behind-the-scenes data manipulation, but it might 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 “Multicolumn Layouts” section later in this chapter for some tips that will come in handy for working with label layouts.
  • Vertical Labels— This layout is used for Asian and full-width characters that will be rotated so that the labels can be used vertically.
  • 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 might have 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 that you can 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 new developers. Besides, if you are new to FileMaker, nothing beats spending an hour just playing around with the assistant to see firsthand 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 you create a layout, you can completely modify it and turn it 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

No tool is 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 layout 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 must 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 Layouts, Duplicate Layout. Often, this is a preferred method for creating new layouts, even if they end up looking significantly different from the original. All part sizes, graphic elements, and formatting options are 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. In a large project, you might create several template layouts: one for form views, another for layout views, and so forth.


Layout Context

Every layout is linked to a table occurrence from the Relationships Graph. You specify this on the first screen of the Layout Wizard in the Show Fields From area; a similar area exists in the Layout Setup dialog, described later. Many layouts can be linked to a particular table occurrence, but each layout must be tied to one, and only one, table occurrence.

image For more information on table occurrences, seeAdding a Table Occurrence to the Relationships Graph,” p. 222.

The reason layouts need to be associated with table occurrences is that, in a multitable file, FileMaker needs some way to know 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. Context, in turn, determines the table from which the layout will show records, and establishes the reference point for other types of operations, such as displaying data from related tables and evaluating calculations that reference related tables.

image 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 source tables themselves. If you were only concerned with displaying records from the source table, you wouldn’t have to worry about table occurrences. But layouts must also be able to contain records from related tables (that is, portals), and relationships are built between table occurrences, not between source tables. Having a layout linked to a table occurrence makes it unambiguous which context FileMaker should use to access related records.

Consider it in terms of perspective. To view any data within your solution, your user needs a starting point, or perspective, and an endpoint. For example, you might be looking from Company Detail through a portal to Employees related to that company record. The associated table occurrence tied to a given layout serves as a user’s starting point, and any related data is viewed from that table occurrence’s perspective on the Relationships Graph.

image If you’re unfamiliar with relational data modeling or how to display related data in FileMaker, see Chapter 5, “Relational Database Design,” p. 163, and Chapter 6, “Working with Multiple Tables,” p. 195.

When you define a new layout, the very first prompt of the New Layout/Report Assistant lets you specify where to show records from. The options in the pick list are all the table occurrences from the current file’s Relationships Graph.

If you do have multiple occurrences of any of your source tables, the selection of a particular occurrence in no way affects your ability to see or edit field data in the source table itself. That is, if you don’t intend to put any related fields on the layout, it’s likely to be inconsequential which occurrence of that source 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.

image The implications of context for scripting are discussed elsewhere; seeScript Context and Internal Navigation,” p. 302.

Layout Setup

The Layout Setup dialog, accessed under the Layouts 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.4).

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

image

In the Layout Setup dialog, you name the layout and select the table (actually the table occurrence from the Relationships Graph) that is the base table for the layout. Data from other tables can appear in the layout, but there is always one, and only one, base table for each layout.


Note

Naming your layout as well as the objects within it is just as important as naming fields and tables. The “Layout Naming Conventions” section later in this chapter provides guidance in these areas. The “Hiding and Reordering Layouts” section, also later in this chapter, gives you some tips on how to handle the Include in Layout Menus check box.


Check boxes also let you save record changes automatically if you want to. These changes are the changes to the layout itself (not to its data). If you are doing a lot of layout modification, you can choose to have your changes automatically saved without a prompt. When major development is over, you might want to turn this option back on so that the relatively rare updates to layouts are reviewed more carefully.

The Field Frames check box influences the layout’s behavior in Browse mode. It is a good idea to select the same setting for this check box for all layouts in a given solution so that users know what to expect.

image You can provide custom menu sets for each layout. To do so, see Chapter 14, “Advanced Interface Techniques,” p. 415.

View Options

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


Tip

In developing a custom solution, you can provide scripted buttons to switch from layout view to layout view. If you do so, you can use the scripts to enforce certain standards, such as always viewing a certain layout with a certain view (at least to start). By using a combination of hiding the Status Area and a custom menu set, you can even hide the standard FileMaker Pro commands that allow users to switch from view to view without using the controlled scripts that will limit the experience and flexibility but provide more consistency. This is particularly useful when your users are not adept at using FileMaker Pro.


The differences among 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 have to scroll to see the footer. If the body part is short, the last part on the layout expands to fill the empty space in the window. If you are using scripts to navigate among layouts, you can adjust the window automatically to fit the form so that there is no 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 more than 111 inches. For some long forms, such as legal contracts, you might have to split the form into two separate layouts.
  • View as List— With View as List, the height of the layout body part and the height of the window determines the number of records displayed. If more records are present in the found set than can be displayed onscreen, the vertical scrollbar enables users to see additional records. Any header and footer parts are fixed onscreen 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 placed in the layout’s body are presented in a spreadsheet-like grid. The fields’ top-to-bottom position on the layout determines their initial order. That is, the first column is the topmost field on the layout. No nonfield elements (for example, buttons, text, or graphics) from the body of the layout are rendered in Table view. Field formatting (for example, color, font, and font size) is honored, however. 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.5, you can specify whether header and footer parts should be visible and whether columns can be sorted, reordered, and resized. You can also specify row heights there.

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

image

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.

Multicolumn 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.6.

Figure 4.6. You can customize the print settings for a particular layout on the Printing tab of the Layout Setup dialog.

image

In Layout mode, dashed vertical lines represent the boundaries between columns. FileMaker grays out columns other than the first; the idea is that you need to place any objects you want displayed in the first column, and these objects replicate to the other columns as necessary. Figure 4.7 shows an example of a three-column layout: the Avery 5160 label layout from Contact Management. 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 have to add them explicitly.

Figure 4.7. This example shows a layout for the three-column Avery 5160 layout from the Contact Management Starter Solution.

image

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 the dashed divider between the first and second columns and dragging left or right as appropriate.

You can use subsummary parts and leading and trailing grand summaries on multicolumn layouts, but they behave slightly differently depending on whether you choose to display data Across First or Down First. If you choose the Down First option, any summary parts are also columnar. On the other hand, if you choose the Across First option, summary parts span the full width of the layout, just as the header and footer parts do.

image Subsummary parts are covered in depth in “Working with Parts,” p. 133.

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

Hiding and Reordering Layouts

In Browse mode, layouts can be designated to 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, assuming that the Status Area is visible and/or accessible. If the layout 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 might be unanticipated and/or undesired results if a user is able to bypass the scripts you 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.8, 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.8. Use the Set Layout Order dialog to set the accessibility and order of layouts.

image

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 (image) [Ctrl] and the up or down arrow.


Note

In FileMaker 6 and earlier versions, you are 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 preceding 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. Moreover, making layouts inaccessible affects all users; you can’t set up rules to determine which layouts are accessible for which users.

You can achieve added protection for layouts by restricting access via security privilege sets. A privilege set can be defined to provide All No Access, All View Only, or All Modifiable control over all layouts at once; alternatively, you can specify custom layout privileges for each individual layout, as shown in Figure 4.9. You can protect editing of 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.9. Custom layout privileges enable you to restrict certain users from modifying or viewing certain layouts.

image

image For more information about setting up privilege sets, seePrivilege Sets,” p. 381.

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

Note that the preceding security settings allow developers to give users the ability to edit some layouts but not others, and to create their own layouts (or not). It is possible in FileMaker to establish “junior developer users” who can exercise a degree of freedom within certain areas of a given system without jeopardizing critical or more complex areas.

Layout Naming Conventions

You have a great deal of flexibility in how you name layouts. Layout names do not have 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. Although flexibility is a good thing, we suggest that you follow a few guidelines:

  • If a layout has the potential for access via ODBC or Custom Web Publishing, you should avoid symbols, punctuation, and spaces in its name.
  • Only the first 8 to 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 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 such as List and Layout #3 might not convey much meaning to users, or future developers, for that matter.
  • In a multitable file, consider having the base table name as part of the layout name. For instance, Customer:Data Entry and Data Entry (Customer) might be good names if you need to differentiate among multiple data-entry layouts. Note that this may conflict with the first guideline about not having symbols, punctuation, or spaces in the layout name.
  • You can use a z prefix for internally used layouts. You can omit them from the Layout menu or place them at the bottom (using the Set Layout Order command from the Layouts menu in Layout mode). You can also use a distinctive theme in the Layout Wizard. Any or all of these will make it clear when you are working in a layout that users will not normally see.
  • 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.

In practice, the issues involved in naming layouts might work themselves out quite easily. If you are building a solution with multiple layouts, you might very well build navigation tools into the layouts (commonly at the top of a layout). This means that when you go to a layout using a script, you automatically adjust the window, or in the case of a layout designed for printing, you automatically go into Preview mode. In that case, you can name layouts from the developer’s perspective and hide them from users in the Layouts menu.


Tip

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


Working with Parts

Parts make up layouts. Depending on your objectives, your layout might contain header and footer parts, a body part, one or more subsummary parts, and maybe even a leading or trailing grand summary. Every layout must contain at least one part. Briefly, the purpose and some characteristics of each type of part are as listed here:

  • Title Header— Title headers are used when you need a header on the first page that differs from the header on subsequent pages of a multipage report. In Form view, a user can view a title header while in Browse mode, but not in List or Table view.
  • Header— Objects in the header part appear at the top of each page of a multipage report except the first page when a title header is present. A header part remains fixed onscreen in List and Table views, even when a user scrolls to see additional records. Data in fields placed in a header part can be edited; fields in a header part always display data from the currently active record.
  • Leading Grand Summary— Typically used on report layouts, a leading grand summary appears between the header and any subsummary or body parts. Summary fields placed in this part aggregate across the entire found set.

    image For more information about using summary fields and summary parts to create reports, seeSummarized Reports,” p. 329.

  • Body— The body part is used to display data from a single record. A data-entry layout often consists of nothing other than a body part. Almost every layout you create will have a body part.
  • Subsummary— Subsummary parts are used primarily for displaying subtotals on reports. For a subsummary to display properly, the found set must be sorted by the same field as that on which the subsummary is based, and you must be in Preview mode. Subsummaries can be placed either above or below the body part, depending on whether you want the subtotals displayed before or after the data they summarize.
  • Trailing Grand Summary— Similar to a leading grand summary, a trailing grand summary is typically found on report layouts and is used to display aggregate summaries. When printed, the trailing grand summary report appears directly following the body part and any trailing subsummaries.
  • Footer— Objects in the footer appear on every page of a multipage printout except on the first page when a title footer is present. In List view, the footer remains fixed on the layout when a user scrolls through records.
  • Title Footer— A title footer part is used when you want to display a different footer on the first page of a multipage printout.

Tip

You can save time creating complex layouts by beginning with a layout that might never see the light of day. Create a layout with a body part and as many subsummaries as you might ever need. Then duplicate the layout and remove parts that you don’t need. For example, you can delete the body part from a duplicate and—voilà—you have a summary layout. Likewise, you can delete some of or all the subsummaries to produce a detail report. To finish up, you can even delete the original layout.


Adding and Ordering Parts

There are two ways to add parts to a layout. The first is by clicking and dragging the Part button in the Status Area to the point where you want the new part to appear. FileMaker prompts you to select a part type when you release the mouse. Although it is convenient, we discourage this method of adding new parts. New parts, except when added to the very bottom of the layout, always come at the expense of existing parts. That is, if you have a 50-pixel header followed by a 200-pixel body, and you attempt to add a subsummary between these parts, the body part shrinks by the size of the subsummary part. Moreover, fields that were in the body part might now be part of the subsummary part.

The other option for adding new parts, which we prefer in almost every circumstance, is to use the Part Setup dialog (shown in Figure 4.10), which can be found under the Layouts menu. When you add parts with this tool, it’s not at the expense of any existing part; the total height of the layout increases.

Figure 4.10. You can add, edit, delete, and reorder the parts on a layout from the Part Setup dialog.

image

The Part Setup dialog can also be used to reorder, edit, and delete parts. The only types of parts that can be reordered are the body and subsummary parts. To reorder them, click the arrow in front of the part name and drag it to the desired position. Other part types appear with a lock in front of them, indicating that they are fixed in a certain order by definition.

You can delete a part from a layout either by selecting it from the Part Setup dialog and clicking Delete, or by clicking the part label while in Layout mode and pressing the Backspace or Delete key on your keyboard. Either way, when you delete a part, you also delete any objects contained in that part.

Formatting a Part

You can configure a few attributes of parts directly from Layout mode itself. First, you can set a background color and/or fill pattern for a part by clicking the part label and then selecting a color and/or fill pattern. (Control-clicking) [right-clicking] the part label similarly pulls up a contextual menu with access to these attributes.

You can achieve much the same effect simply by drawing a large rectangle on the layout, sending it to the back, and locking it. Setting a background color for the part is preferred because the color extends to the right and downward if the user expands the window beyond the boundaries of your rectangle.


Tip

For users with monitors set to higher resolutions than your database was designed for, consider adding a footer with a background color different from your body part so that users can visually see where the layout ends and size their windows appropriately. Alternatively, use buttons and scripts for layout navigation so that you can automatically adjust the window to the layout.


You can also change a part’s size. To do this, simply click the dividing line between two parts and drag either up or down. When making a part smaller, you can remove whitespace from the part, but you are prevented from dragging through any objects in the part. Any expansion of a part increases the overall size of the part.

Holding down (Option) [Alt] as you resize a part changes the rules slightly. First, any expansion or contraction comes at the benefit or expense of the neighboring part; the overall height of the layout remains the same (except, of course, when enlarging the last part on the layout). Also, you can “run over” objects this way; an object that was in one part might end up belonging to another part after you resize things. An object that ends up straddling two (or more) parts belongs to the part that contains its upper-left corner.

The Object Info palette can also be used to see and set a part’s length. This is the best way to set part lengths precisely, especially when trying to duplicate complex layouts from one file to another. Click the part label to display that part’s data in the Size palette.

image For more information about the Object Info palette, seePositioning Objects on a Layout,” p. 141.

Part Definition

Beyond the size and background color of a part, some part attributes can be set only in the Part Definition dialog, shown in Figure 4.11. You can get to this dialog either by using the Part Setup dialog (by clicking Create or Change), or by double-clicking the part label itself.

Figure 4.11. The Part Definition dialog specifies a part’s type and attributes.

image

The radio buttons on the left side of this dialog indicate the type of part. You can change the type of a part simply by selecting a different radio button. If a type is grayed out, it means you already have a part of that type. The only part type for which you can have multiples is subsummary.

The fields on the right side of the dialog apply only to subsummary parts. When you make a subsummary part, you must specify which field will act as the break field for the summary. The break field doesn’t actually have to appear in that part, but the found set must be sorted by the break field for the subsummary part to appear on a report.

image For more information on break fields and subsummary reports, seeSummarized Reports,” p. 329.


Tip

If there is a script to display the layout, as is the case if you have used the wizard, that script contains a Sort step. When you add or change a subsummary part, make it a habit to immediately go to the script and change the sort so that it reflects the new or changed sorting order.


At the bottom of the dialog are some options for configuring page breaks and page numbers. In subsummary reports, you’ll often want each new subsection to start on a new page. To do this, you edit the part definition of the subsummary part to include the Page Break Before Each Occurrence option. As you would expect, a page break precedes only each occurrence after the first one.

You can also opt to use the Alternate Background Fill feature. This option is available only on body parts. Any color and/or fill that you specify is used as the background for every other record. It alternates with any background color specified for the part itself. A slight shading of alternate rows on a report often makes it easier to read.

Working with Objects on a Layout

As stated previously, a layout is essentially a collection of objects manifested as a screen that allows users to see and/or modify data. We’ll refer in the abstract to anything that you can place on a layout as a layout object. Many tools and techniques exist for configuring and manipulating layout objects. Some of these apply only to specific types of objects, whereas others are more general in nature. The better you know how to work with the tools for crafting layouts, the better your user interface will be, although there are of course no guarantees.

Adding Objects to a Layout

The Status Area in Layout mode provides a set of design tools for adding and manipulating layout objects. Figure 4.12 shows these tools.

Figure 4.12. The Status Area contains most of the tools you need for designing layouts.

image


Tip

In Layout mode, the book icon can be used to move from layout to layout. The keyboard shortcut for this, (image-up arrow) [Ctrl+up arrow], is the same one used in Browse mode to move from record to record, and in Preview mode to move from page to page.


The layout tools in the middle of the Status Area are used to add new objects to a layout. Tools exist for adding text blocks, lines, rectangles, rounded rectangles, ovals, buttons, fields with value list controls, Tab Control objects, Web Viewers, and portals. With each, you can simply click the tool to activate it, and then click and drag on your layout where you want the object to appear.

Normally, when you finish creating an object, FileMaker reselects the pointer tool automatically. At times, however, you’ll want to create multiple objects of the same type at once. In those cases, it’s useful to lock in the selection of a particular tool. You can do this by double-clicking the tool in the Status Area. There’s also a preference on the Layout tab of the application preferences screen to Always Lock Layout Tools, although we advise against enabling it.

Some objects that you add to a layout, such as fields or Web Viewers, require additional information, such as the name of the data to display. In such cases, a dialog immediately opens for you to provide the information. Figure 4.13 shows the Specify Field dialog that opens as soon as you drag the Field icon into the layout. Note that you can select fields from the current table, related tables, and even unrelated tables.

Figure 4.13. Specify fields for a newly-created field object.

image

image For more information on adding fields to a layout, seeWorking with Fields” later in this chapter, p. 152.

The Insert menu provides another means for adding objects to a layout. At the top of this menu, you’ll find selections for adding all the object types found in the Status Area.


Caution

Unless the Status Area is closed and locked for some reason, we prefer not to use the Insert menu because it doesn’t provide an opportunity to specify location or size during object creation. Either duplicate existing objects or use the tools from the Status Area when at all possible.


To insert a picture or another graphic element developed externally, you can use the Insert, Graphic menu command. Alternatively, you can simply cut and paste objects from many other applications directly into your FileMaker layouts.

Specifying Object Attributes

You have a great deal of control over the attributes of any object you place on a layout. Different object types can have different attribute options. You can always tell what attributes of an object can be configured by (Control-clicking) [right-clicking] the object. A contextual menu appears, listing any formatting options that are appropriate to that particular object type. Menu commands and Status Area tools provide access to the same attribute settings, but the most efficient way to set an object’s attributes is to use the contextual menus.

The Format Painter Tool

You can copy the formatting attributes from one object to other objects on your layout by using the Format Painter tool. The Format Painter can be found under the Format menu and in the Standard toolbar, which you can enable from the View, Toolbars menu.

To use the Format Painter, you select an object that has the formatting attributes you want to propagate, and then turn on the Format Painter, using either of the two methods just mentioned. A small paintbrush appears next to your mouse pointer, indicating that the Format Painter tool is active. Then select the object or set of objects to which you want to apply the formats. You can lock in the Format Painter tool by double-clicking its icon on the Standard toolbar. This enables you to click on several objects and apply formats as you go.

Setting Default Object Attributes

The default format attributes include such things as the font, font size, font color, text style (for example, bold and italics), pen width, alignment, shading, paragraph settings, and object effects. In short, any configurable attribute of a layout object has a default setting. Not all objects, of course, have all the potential attributes. Rectangles, for instance, have shading and pen width attributes but don’t have any font attributes. When you add a new object of any sort to a layout with the layout tools, the applicable attributes of that object inherit the current default settings. You can, of course, change the attributes of an object after you place it on a layout.

The default format attributes are stored at the file level. This means that as you move from layout to layout within a file, the defaults stay the same, but if you’re working with multiple files, each might have its own defaults.

When you first create a file, the default text format is vanilla: 12-point black Helvetica (Mac), 12-point Arial (Windows), no object effects, no text styles, no field borders, and no shading. You can change the default settings in one of two ways:

  • In Layout mode, if you have no objects selected, any formatting options you change apply to the default text attributes. Only the attributes you change are affected.
  • If you (image-click) [Ctrl+click] an object, that object’s characteristics become the default. This is the easiest way to set the default; you can simply format one object with the settings you want and then (image-click) [Ctrl+click] it. All that object’s attributes together become the new default; any attributes that the object doesn’t possess are not affected.

Tip

If multiple layout objects are selected and you (image-click) [Ctrl+click] any one of them, the frontmost object’s characteristics become the default.


If you have a file open as a guest, either of FileMaker Pro or of FileMaker Server, any changes you make to the default attributes persist only until you close the file; those defaults aren’t stored in the file and don’t affect other developers in the system. When you’re the host of a file, any changes you make to the default attributes are stored and persist until you change them again, even if you close and reopen the file.

Duplicating Layout Objects

Any object on a layout can be duplicated in one of two ways. When you duplicate an object or a set of objects, the new objects have all the same attributes of the source objects. It is, therefore, often faster and more efficient to create a new object by duplicating an existing one and modifying it rather than by adding a new one using the layout tools.

The first way is simply to select some set of objects and choose Edit, Duplicate or press (image-D) [Ctrl+D]. The entire set of objects is duplicated, with the new objects appearing 6 pixels to the right and 6 pixels lower than the original set. The new objects are selected (as opposed to the original set), so you can easily move them to wherever you want.

A useful technique exists for creating multiple copies of an object spaced out at consistent intervals. Begin by selecting a set of objects, which we’ll call set A, and duplicate it as described, creating set B. Without deselecting any of the objects in set B, move them to some desired place on a layout. Choose Edit, Duplicate again; the new copy, set C, instead of having the “6 pixels to the right, 6 pixels down” relationship to its source, is spaced an equal distance from set B as B is from A. Continued selection of Edit, Duplicate results in additional new sets, each positioned a consistent distance from its source. This technique is very useful for creating columnar lists and grids of equally spaced lines.

The second way to duplicate layout objects is to (Option-drag) [Ctrl+drag] them. Simply select a set of objects, and then start to drag them as if you intended to move them to a new location on the layout. As you move the objects, however, hold down the (Option) [Ctrl] key. Continue to hold this key down until after you release the mouse click; the objects are not moved, but a copy of them is placed at the new location.


Tip

You can also hold down the Shift key as you’re dragging the objects to constrain movement to a vertical or horizontal axis. This is our preferred method for duplicating layout objects.


Positioning Objects on a Layout

Much of layout design is simply moving things around until they look just right. This is also one of the most intuitive things for new developers to learn. So much so, in fact, that many never learn some of the fine points of working with objects on a layout. We will attempt to remedy that problem here.

Selecting Objects on a Layout

Most object formatting and positioning on a layout begins with the selection of a set of objects to work with. You can go about selecting objects in several ways; knowing these methods can greatly increase your efficiency at designing layouts. Here are your options:

  • Click an object—You can select any object simply by clicking it. When you do so, small squares, called handles, appear at the four corners of the object, indicating that the object is indeed selected.
  • Shift+click—When you have one or more objects selected, you can Shift+click an additional object to add it to the selected set. Similarly, Shift+clicking an already-selected object removes it from the selected set.
  • Selection box—If you click the background of the layout (that is, any place there’s not an object) and drag a rectangle across the screen, any objects that were completely contained within your selection box are selected when you release the mouse. This is typically the easiest and quickest way to select multiple objects.

Note

If you hold down the (image) [Ctrl] key while dragging a selection box on the screen, any objects touched by (instead of contained by) the box are selected. This technique works well for selecting objects that might partially overlap other objects, when using the enclosing method would result in too many selected objects.


  • Select all objects—To select all the objects on a layout, choose Edit, Select All, or use the (image-A) [Ctrl+A]) keyboard shortcut.
  • Select all instances of a type of object—It’s also possible to select all instances of a particular type of object, such as all the text objects, or all the fields, or all the rectangles. There are several ways to do this. If the Arrange toolbar is visible, you can select an object, and then click the Select Objects by Type button in that toolbar to select all similar objects. Or you can select an object, and then press (image-Option-A) [Ctrl+Alt+A] to accomplish the same thing. Finally, if you have a tool other than the Button or Portal tool selected from the layout tools, you can select all the objects of that type by choosing Edit, Select All.
Moving Objects

After you select a set of objects, you can move those objects around on the layout—provided that they are not locked—in a few ways. First, you can click the interior of any object in the selected set and drag the set to a new location. You can also use the arrow keys on your keyboard to move a selected set of objects pixel by pixel.

Using the click-and-drag method, hold down the Shift key after you start dragging the objects, and the movement will be constrained to either the vertical or the horizontal plane. That is, there is no way of moving the objects other than up and down or from side to side. This is very useful for keeping objects properly aligned as you reposition them.

Resizing Objects

When you select an object, four small black or gray squares appear at the corners of the object. These define the object’s boundaries; they are called the object’s handles. All objects, even circular ones, have a rectangular footprint defined by the four handles. Gray handles indicate that the object is locked; it can’t be moved or resized in this state (see the “Locking Objects” section later in this chapter).

You can resize an object by clicking one of the four handles and dragging in the desired direction. Unlike some other graphic applications, FileMaker does not enable you to click on the sides of the object to change just the height or width of the object. You must always use the object’s corners. Just as when moving objects, you can, however, constrain movement to the vertical or horizontal plane by holding down the Shift key as you drag to resize the object.

If you have selected multiple objects, resizing any one of them causes all the objects to resize by a similar amount. This is very useful in cases in which you want to select, for instance, five fields and make them all slightly longer or shorter. Resizing them as a set ensures that they all change by the same relative amount.

FileMaker 8 introduced the new Resize To alignment tools. Available in the Arrange menu in Layout mode, these tools allow developers to make a group of objects consistent by resizing all objects in the group to the largest or smallest width or height of the objects selected.

The Object Grid

You have the option, when working with layouts, of enabling or disabling an object grid. You can change the status of the object grid by toggling the Object Grids command found at the bottom of the Arrange menu. You can also toggle the status of the object grid by pressing (image-Y) [Ctrl+Y].

When object grids are enabled, all movement and resizing of objects takes place against a virtual grid. Each square of the grid measures 6 pixels by 6 pixels. The effect of this is that when you are moving or resizing objects, movement happens in 6-pixel chunks. When the object grids are disabled, movement happens in 1-pixel units, resulting in fluid motion.


Tip

You can change the default grid spacing to something other than 6 pixels by using the Layouts, Set Rulers menu.


The object grids are defined relative to each object; that is, there’s no static grid to which everything snaps. If object A and object B are 2 pixels apart, with object grids enabled, you could move each object one “chunk” in any direction and they’d still be 2 pixels apart, each having moved 6 pixels from its original location.

Whether you choose to have object grids enabled as you design layouts is purely a personal preference. Some developers love object grids; others loath them. Even the authors of this book are passionately divided on this subject. The benefit of using the object grids is that they make it easy to keep things arranged and sized nicely. It’s much easier to notice visually when an object is 6 pixels off-line rather than 1 pixel. Plus, if you ever need to move things in finer increments, you can simply use the arrow keys to nudge the objects into line. In addition, you can temporarily suspend the object grids by holding down the (image) [Alt] key as you move or resize an object. On the con side of things, for developers used to positioning things exactly to the pixel, the object grid can get in the way and prove simply cumbersome to work around.

The object grid’s status is a file-level setting. That is, as you work on different layouts within a file, the grid status carries through to them all. But if you have multiple files in a solution, you could conceivably have the object grid enabled in some files and not in others.

The Object Info Palette

The Object Info palette is a floating toolbox that can be used to see and set very precise object positions and other characteristics of an object. It’s shown in Figure 4.14. To make the palette appear, choose View, Object Info. It’s an application-level setting, so after you have the palette onscreen, it is available no matter which layout you are working with. You can move the palette around on your screen so that it’s optimally positioned for whatever task you need it for.

Figure 4.14. The Object Info palette is quite useful for positioning and sizing objects on a layout.

image

The Object Info palette provides six pieces of data about the position and size of a selected object (or set of objects). From top to bottom, these data points represent the following:

  • The distance from the left edge of the object to the left edge of the layout
  • The distance from the top edge of the object to the top edge of the layout
  • The distance from the right edge of the object to the left edge of the layout
  • The distance from the bottom edge of the object to the top edge of the layout
  • The object’s width
  • The object’s height

image These values can be overridden when a window is resized if you use the new autoresizing features. For more on autoresizing, seeAutomatically Resizing Objects on a Layout,” p. 145.

In these definitions, the left edge and top edge of the layout might be outside the area you can actively work with. Most layouts have a default page margin, usually .25 inches on each side. You can make your layout’s page margins visible by choosing View, Page Margins. Fixed page margins can be set under the Printing tab of the Layout Setup dialog.


Caution

It’s important to know that page margins factor into the distances displayed in the Size palette. You can’t move or position an object in the page margin. If you are trying to use absolute positioning to align objects on different layouts, take into consideration any differences in page margins.


The Object Info palette can measure distance as inches, centimeters, or pixels. You’ll see the unit displayed on the right edge of the palette itself. You can toggle among the three available units simply by clicking any of the unit labels.


Tip

We find that setting the Object Info palette to display pixels is much more intuitive and useful than using inches or centimeters.


The Object Info palette doesn’t merely report on the position and size of a selected object; you can use it to set these attributes. With an object selected, you can click into and edit any of the six data points. Pressing the Tab or Return key moves you through the palette’s fields. Pressing the Enter key exits the palette (for users with both keys on their keyboard; if you’re working on a laptop, there’s usually just an Enter key). As you change the numbers in the palette, the selected object moves or resizes as you have specified. This makes it very easy to precisely align, position, and size objects on a layout.


Tip

If you’re working on a laptop that lacks a Return key, (image-Enter) [Ctrl+Enter] exits the Object Info palette and returns focus to your prior window with your objects still selected.


Naming Objects on a Layout

image

You can now name objects on a layout. You do so by typing in a name in the Object Info palette. Object names must be unique on a given layout. They most often work in conjunction with the new Go To Object script step. When you go to a layout, you can immediately select the specific field, portal, tab, or any other layout object that you want to select. You can even determine this dynamically in a script that goes to a given layout—yet another reason for using scripts for layout navigation. The combination of object names and the Go To Object script step makes FileMaker Pro a much more powerful interface development system.

Automatically Resizing Objects on a Layout

image

The Object Info palette also implements a new feature in FileMaker Pro 9: automatic resizing of objects on a layout. For the selected object, you can choose to bind it to the edge of the window or its container (such as a portal) by clicking the appropriate box by the anchor in the direction you want to bind it. You can check any of from 0 to 4 boxes.

As the layout window is resized, any bound edge of an object moves to keep its same distance from the edge to which it is bound. Thus, you can create a text field that expands horizontally with the window, but whose vertical height is fixed (that is, unbound).

Objects that contain data or that are backgrounds are prime candidates for autoresizing. Objects such as buttons are not normally expected to change size as a window resizes, but you may choose to anchor them to a constant location relative to the window.

The default behavior is what has happened until now: Objects are placed in a layout, and, as the window is resized, they remain where they are relative to the top and left. Thus, if you widen or lengthen a window, you might have unused space at the right or bottom. Now that you can see what the bindings are, you will see that this is implemented by default with the top and left sides of objects bound to the window.

If you bind an object to the right and bottom, it will stay at the bottom right of the window as you change its size. If you bind an object to the right and left, it will stretch as the window is resized horizontally; likewise, an object bound to the top and bottom will stretch. If you have a large object such as a Web Viewer, you may choose to bind it to all four edges. It will resize as the window is resized in any direction and will retain its distance from each of the new edges.


Note

In preview mode (and, thus, in printing), there is no vertical resizing. Horizontal resizing occurs if the page size is wider than the layout.


Arranging Objects

FileMaker provides many tools to help you organize and arrange objects on a layout. This section discusses some of these tools.

Grouping Objects

Objects can be grouped together to form a new object. You do so by selecting the desired objects and choosing Arrange, Group or pressing (image-R) [Ctrl+R]. The resulting object behaves just like any other object. It has a single set of selection handles, and you can move and resize it as described in the previous sections. Any formatting applied to the grouped object is applied to each of the elements of the group, as if you had simply selected all the elements individually. Grouped objects can be further grouped with other objects to form new objects.

To ungroup an object, select the object, and then choose Arrange, Ungroup or press (image-Shift-R) [Ctrl+Shift+R]. If an object was formatted as a button, ungrouping it deletes the button definition.


Tip

Ungrouping an object is the easiest way to remove a button definition from an object. This works even if the object in question isn’t a grouped object.


Locking Objects

To prevent an object from being moved, resized, reformatted, or deleted, you can lock it by selecting it and choosing Arrange, Lock or pressing (image-Option-L) [Ctrl+Alt+L]. When you select a locked object, its handles appear grayed out rather than black.

When you select a combination of locked and unlocked objects and attempt to move or resize them as a set, only the unlocked objects are affected. If you attempt to change the formatting of the selected set, you see an error that the formatting can’t be applied to some objects in the set because they are locked.

Locking objects is very useful when you have objects stacked on top of or overlapping one another. It’s as if the locked objects become a backdrop against which you do your work. Whether you leave the objects permanently or temporarily locked, it becomes much easier to select and work with certain objects when the objects behind them are locked. To unlock an object, choose Arrange, Unlock, or press (image-Option-Shift-L) [Ctrl+Alt+Shift+L].

Aligning Objects

It’s often desirable to align objects on a layout relative to one another, and FileMaker has some built-in tools to make this easy to do. For instance, a layout might have 10 fields that you want to be aligned along their left edges. You can use the Align, Distribute, and Resize To menu options, under the Arrange menu, to manipulate objects relative to each other.

You can specify a Top to Bottom alignment, or a Left to Right alignment, or both. You can also distribute objects or resize to the largest or smallest dimensions of the selected objects.

When you align a set of objects relative to one another, one of the objects usually serves as the reference point. For instance, when you left-align a set of objects, the leftmost object is the reference point. The other objects move left while the leftmost object remains in place. Similar results are obtained for aligning to the right, top, and bottom. The exception to this is when one or more of the selected objects is locked. If this is the case, and you want to, say, left-align a set of objects, the leftmost locked object becomes the reference point.

The rules for centering are slightly different. When centering left to right, the objects align on the midpoint between the leftmost and rightmost selection points. For top-to-bottom centering, they align on the midpoint between the topmost and bottommost selection points.

The option to distribute space is useful when you want to be sure that objects in a set are equidistant from one another. The two outermost objects, whether left-to-right or top-to-bottom, act as anchors for the distribution: The selected objects in between them are spaced apart evenly.


Tip

Even the sloppiest of developers can benefit from this simple process: Select a group of irregularly placed and irregularly sized fields. Then choose Arrange, Align, Left Edges, followed by Arrange, Distribute, Vertically. Last, select Resize To, Largest Width and Height. Voilà—your layout objects are now nicely sized and positioned.


Layering Objects

FileMaker maintains a stacking order for objects on a layout. When you add a new object to a layout, it becomes the frontmost item in the stacking order. The stacking order becomes important when objects overlap one another. If two objects overlap, object A appears in front of object B if it is forward in the stacking order. In addition, if object B is completely behind object A, it is impossible to select object B simply by clicking it. When you click a spot on a layout where multiple objects overlap, you select the frontmost of the objects.

There is no way to review the stacking order of the objects on a layout visually. But you can manipulate the stacking order by using the Bring to Front, Bring Forward, Send to Back, and Send Backward functions, all of which can be found under the Arrange menu.

image The stacking order also determines the tab order of layouts published to the Web with Instant Web Publishing. For more on IWP, seeLayout Design,” p. 705.


Note

The stacking order also determines the order in which objects draw on the screen. With a local file or on a fast network, it’s probably imperceptible, but on slow networks, you will sometimes see the objects draw one by one, from back to front.


Sliding Objects

If you are developing layouts that you intend to be printed, and you have variable amounts of text in certain fields, you might want to configure some objects on your layout to slide. Sliding eliminates excess whitespace from an object, allowing it to appear closer to its neighboring objects. You can configure an object to slide either up or to the left, using the dialog shown in Figure 4.15, which you open by selecting a set of objects and choosing Format, Sliding/Printing.

Figure 4.15. You can configure an object to slide either up or to the left by using the Set Sliding/Printing dialog.

image

The effects of sliding can’t be seen unless you are in Preview mode (or you actually print). If you set a field to slide, any whitespace in the field is removed in Preview mode. One caveat to know is that the contents of a field must be top-aligned to slide up and left-aligned to slide left.

Sliding does not reduce the amount of space between objects. Imagine you have a large text field, with a horizontal line located 10 pixels below the bottom of the field. If you set both objects to slide up, empty space in the field will be removed, and the line will slide up until it is 10 pixels away from the bottom of the field.

The option to Also Reduce the Size of the Enclosing Part is useful when you have a list of variable-length records. Set the layout to accommodate the longest possible amount of data, and then turn on sliding for all the fields in the body and reduce the size of the enclosing part. The rows of the list will have a variable length when you preview and print them. You must be sure to set all the objects in the list to slide; a single nonsliding object can cause the part to not reduce properly. Objects such as vertical lines do not shrink in size to accommodate variable record widths, so if you need this effect, use left or right field borders, which do shrink appropriately.

Sliding can be applied to portals as well, but objects in a portal can’t slide. If a portal is set to slide up, any blank rows of the portal are suppressed, but there’s no way to make the height of the individual rows of the portal variable. Portal sliding is useful and necessary in reports that must pull in data from related files. Typically, if there’s a portal on a printable report, you should set the portal to display a large number of records and not to have a vertical scroll. If you enable sliding as well, any unneeded portal rows simply disappear.

The Set Sliding/Printing dialog also has an option to make a layout object nonprinting. As with sliding, this setting is apparent only in Preview mode. Typically, you use this option to allow buttons, background images, and data entry instructions—items you typically wouldn’t want to have on a printout—to be visible only in Browse and Find modes.

Working with the Tab Control Object

FileMaker 8 introduced the Tab Control object. It is a fantastic development time-saver and can dramatically reduce the number of layouts you’re used to working with in FileMaker solutions.

The Tab Control does one thing: It extends the amount of screen real estate you can provide users by allowing them to flip from one pane to another while remaining on the same layout and same record. For an example, refer to Figure 4.16, which shows a tab control with three tabs at the bottom of its layout.

Figure 4.16. These tab objects allow users an intuitive means of working with multiple panes of information and controls.

image

Adding a Tab Control Object to a Layout

image

The Tab Control Setup dialog has new features in FileMaker Pro 9. To add a Tab Control object to a layout, click the Tab Control button in the Status Area and drag a rectangular area on your layout. You are presented with the Tab Control Setup dialog, as shown in Figure 4.17.

Figure 4.17. The Tab Control Setup dialog enables you to create however many panes you require.

image

In the Tab Control Setup dialog, you can add as many tab panes as necessary and then choose alignment and tab styles. Although the options aren’t exhaustive, the simplicity of working with the Tab Control object will no doubt quickly win you over.

Notice that the width of the tabs on the Tab Control conforms to their text labels if you’ve chosen anything other than Full Justification. If you’d like a little more whitespace for your tabs, or want to tweak their look, you can use our low-tech approach of adding spaces before and after the tab pane labels.

image

FileMaker Pro 9 includes several significant changes to the Tab Control Setup dialog. Perhaps the most important (and most requested) is the ability to set a default front tab. Whenever the Tab Control is shown, the default tab is the one selected.

Useful though that is, another technique can be equally or more useful. If you select a tab in the Tab Control, you can use the Object Info palette to name it. Then, when using a script to go to a layout with a tab control on it, you can go to a specific tab—even changing the tab depending on circumstances. Also new in FileMaker Pro 9 is the ability to set the tab width, as shown in Figure 4.18. After you close the dialog, you remain in Layout mode and can add layout objects—including additional Tab Control objects—to the tab pane currently selected.

Figure 4.18. You can specify the tab width in FileMaker Pro 9.

image

The Tab Control is operational in Layout mode. If you click a tab once, you flip to the pane it represents. If you want to return to editing in the Tab Control Setup dialog, double-click the Tab Control object. If you want to edit the tab pane’s properties (color, line weight, and line color), click the tab a second time. You will see an active rectangle appear.

Be aware that you cannot control what color a nonactive tab displays. FileMaker automatically determines that color based on the color of the active pane. An obvious workaround is to lay a rectangular object over the top of the tabs in question. When you leave Layout mode, the default pane for that Tab Control object will be the last active pane in which you were working in Layout mode unless you have selected a default front tab as shown in Figure 4.17.

When you select the Tab Control object, notice that its rectangular area includes its tab space. The negative space next to your tabs when they’re not set to Full justification is still considered part of the selected pane. One handy technique we’ve learned is to place a button or text or even field objects in that space: They appear and disappear just as all objects members for a pane do.

One last feature of the Tab Control object is the capability to add objects to a pane by moving the Tab Control behind them in the stacking order. If you move the Tab Control object to the back and then drag it to a location where it encloses a layout object, that object automatically becomes associated with the Tab Control. This technique is a nice way to save time when you have to add a new Tab Control to an existing layout. Simply drag a selection rectangle for the Tab Control object onto a layout, select Move to Back from the Arrange menu, and your object will “slurp up” all the objects higher in the stacking order that it encloses. (The FileMaker team affectionately refers to this feature as “hoovering” objects.)


Caution

FileMaker has long had a history of being backwards-compatible. New features, such as the Web Viewer, simply do not appear when you open databases with an earlier version (in this case, FileMaker Pro 7 or FileMaker Pro 8). Tab Controls, however, are different. If you open a layout in FileMaker Pro 7 that contains a Tab Control, all the objects on all the tabs appear, stacked together.


Working with Fields

The primary purpose of a layout is to allow users to interact with data. By interact, we mean everything from viewing, editing, and formatting to finding and sorting. Although a field is at some level just another type of layout object and can be manipulated using the same tools as other layout objects, a number of tools are designed specifically for working with fields. These provide you with a great deal of freedom and flexibility for creating the interfaces that work best for your users and your solution. We don’t cover every option of every tool here, but rather try to give you a sense of what the tools are and some of the situations in which to use them.

Adding Fields to Layouts

There are essentially two ways you can add fields to a layout: by using the Field button in the Status Area and by duplicating an existing field. The first of these—which is generally also the first method that people learn—involves clicking and dragging the Field button in the Status Area out to the section of the layout where you want to place the field. The current default format attributes govern the attributes of a field added this way. However, the field’s width is always 79 pixels. A combination of the default font, font size, pen width, and object effects (for example, embossing, engraving, and drop shadow) determines its height.

There is a third way to add fields to a layout. If Add Newly Defined Fields To Current Layout is set in the Layout tab of Preferences, the Manage Database dialog will add fields automatically using the default settings if the current layout’s base table is the table to which you have added the fields.

As with other layout objects, when you duplicate an existing field, the new field has all the attributes of the previously existing field (including its width). Remember, to duplicate any layout object, you can select it and either choose Edit, Duplicate or press (image-D) [Ctrl+D], or select it and then (Option-drag) [Ctrl-drag] to a new location. In either case, if you have selected a single field, when you duplicate it, you see the Specify Field dialog and can select the new field. On the other hand, if you select multiple objects, when you duplicate them, you get just the duplicated objects. Keep in mind that you duplicate all the attributes of a field—including any button behaviors you attached to it, tool tips you assigned, and so on.

image There are some issues to be aware of when copying and pasting fields from a layout in one file to a layout in another file. See “Copying and Pasting Fields Between Files” in the “Troubleshooting” section at the end of this chapter.

Each field object on a layout is defined to display data from a particular field. Unless you selected Sample Data in the View, Show menu, you see the field’s name on the object when you’re in Layout mode. If you see:: at the beginning of the field name, that’s an indication that the object is linked to a related field. To know which relationship is used, you need to go into the Field/Control Setup dialog. That’s also where you can redefine a field object to display the contents of a different field. You can get to the Field/Control Setup dialog by double-clicking the object.


Tip

If a field has been defined as a button, double-clicking it takes you to the Button Definition dialog, not the Field/Control Setup dialog. Similarly, if multiple fields are grouped together, right-clicking gives you only the control elements of the dialog.


Field Control Style

You can apply several field control options to the fields on a layout. To get to the Field/Control Setup dialog, which is shown in Figure 4.19, either double-click or right-click the object and choose Field/Control Setup from the contextual menu.

Figure 4.19. The Field/Control Setup dialog enables you to format a field with a range of control choices, set auto-complete behaviors, or set repeating values to display.

image

For standard fields where a user will be manually entering and editing data, the Edit Box format is appropriate. The option to include a vertical scrollbar is normally used only when a user is able and/or expected to type multiple lines of text.

The options to format a field as a Drop-Down List, Pop-Up Menu, Checkbox Set, or Radio Button Set require you to specify a value list that provides the content for the selection values.

Beginning in FileMaker 8, you can apply a Drop-Down Calendar to a field to help with entering dates, and you can toggle either a drop-down indicator icon or a calendar picker icon for the fields you’re working with. The two icons—drop-down indicator and calendar icon—appear only if a field has its right border turned on.

The lower left of the Field/Control Setup dialog is relevant only for fields defined to allow multiple repetitions. You can hard-code the starting and ending repetitions and specify whether a vertical or horizontal orientation should be used. On the right of the dialog, you can opt to change the field associated with the selected object.

Field Behavior

The Field Behavior dialog contains controls for setting when a field is enterable and how a user can exit it. To access this dialog, select one or more fields on a layout, and then choose Format, Field Control, Behavior. You can also (Control-click) [right-click] a field and choose Field Control, Behavior from the contextual menu. Figure 4.20 shows the Field Behavior dialog.

Figure 4.20. Using the Field Behavior dialog, you can specify which modes a field can be entered in, as well as the keystrokes to exit a field.

image

In this dialog, you can control whether a user is able to enter a particular field while in Browse or Find mode. Before version 7 of FileMaker, there was no distinction between modes; a field was either enterable or not. Typically, a user should be able to enter a field in both Browse and Find mode. Sometimes, though, you’ll want a field to be enterable in only one of these modes. For instance, you might have a field that you don’t want users to manually edit, but that they might have to use as part of a query. On the other hand, there might be unindexed fields on your layout that, for performance reasons, you don’t want users to search on.

You can also specify visual spell-checking for each individual field using this dialog. You set the filewide spell-checking option in the File Options dialog in the File menu; this setting overrides that value on a field-by-field basis.

image

The other setting in this dialog is the Go to Next Object Using option. By default, in FileMaker Pro, pressing the Tab key lets users move to the next field on the layout. Developers can also specify the option to allow the Return and/or Enter keys to perform this function. This is desirable in some cases to allow rapid data entry and to prevent data-entry mistakes. For instance, by setting a text field to use the Return key to go to the next field, you prevent users from accidentally adding stray returns at the ends of fields. Obviously, if a user needs to be able to enter carriage returns in a text field—say in a Comments field—you wouldn’t set the Return key to go to the next field.


Caution

Normally, the Enter key serves to commit a record and exit all fields. If you change all your field behavior to have a press of the Enter key move focus to the next field, be aware that users must explicitly click the background of a layout or perform some script or navigation routine to commit record changes.


Setting the Tab Order

When moving from field to field on a layout with the Tab key—or (Return) and/or [Enter], as described in the previous section—the order in which the fields are activated is known as the tab order. The default tab order is the order in which the fields appear on the layout from top to bottom. Rearranging fields changes the tab order.

Tab order is stored with the layout, so there’s no opportunity to customize the tab order for different users. The Set Tab Order dialog is shown in Figure 4.21. After you edit the tab order manually, rearranging fields doesn’t change the tab order. New fields are added to the end of the tab order automatically, regardless of position.

Figure 4.21. You can change the tab order of a layout to make data entry flow in a logical progression for end users.

image

Anyone with the ability to modify a layout can change its tab order; do so by selecting Layouts, Set Tab Order. You can click both fields (the arrows to the left of objects) and objects themselves (the arrows to the right of objects) to manually edit the tab order for a given layout. You can remove items by pressing the Delete or Backspace key.

The dialog operates on like objects. If you want to add all fields to the tab order or remove all objects, choose from the two menu options in the dialog and click the button for the appropriate command.

Note that it is entirely possible to attach a button behavior to a field and for that field to appear twice in the tab order. One instance tabs into the field for editing, and another selects the field to perform the button action.

The Set Tab Order dialog allows developers to add and remove both fields and objects (including Tab Control object tabs) from the tab order of a given layout. Note that FileMaker 8 introduced the capability to tab from object to object on the screen. With a press of either the spacebar or the Enter key, FileMaker performs whatever action is associated with an object, including scripted button actions. Any object made active by tab order displays a highlighted rectangle to the user (regardless of its actual shape). This is a great new feature for users who prefer to drive their computers from their keyboards.

image To further enable users to work from keyboard commands, and review adding keyboard shortcuts via Custom Menus, seeWorking with Custom Menus,” p. 421.

Merge Fields

If you’ve ever done a mail merge, the concept of merge fields should be familiar to you. Merge fields give you a way of incorporating field data within text blocks on a layout. This is useful for creating form letters, labels, and reports.

Merge fields display field data, but they don’t behave like or have all the properties of normal fields. A user can’t click into a merge field to do data entry, for instance.

To add a merge field to a layout, choose Insert, Merge Field, or press (image-Option-M) [Ctrl+Alt+M]. You are prompted to specify a field. After you make your selection, the field name shows up on your layout surrounded by angle brackets. Note that you can add a merge field alone to a layout or you can incorporate it, and potentially others, into a block of text within a text object. A single merge field can contain several actual fields as well as constant text so that it might appear as follows:

Total: <<sTotalPopulation>>; Average Age: <<sAverageAge>>

The primary benefit of merge fields is that field data can be flexibly placed within a text block; text before and after the merge field is repositioned to close up any extra space. Thus, within a text block, you could have “Hi, <<First Name>>, how are you?” On one record, that would come out as “Hi, Joe, how are you?”, whereas on another it might be “Hi, Frederick, how are you?”

Text, number, date, and time formatting applied to a text block is applied to any appropriate merge field within the text block. It is not possible to have a single text block that contains multiple merge fields having different number formats applied to them.


Note

Merge fields are a good way of displaying uneditable data on a layout so that it wraps as you would expect it to in a word processing program. (On report layouts shown in Preview mode or that are printed, the field sliding controls can do the same thing.) However, remember that a field can be searchable and a merge field cannot. You might want to use a field where the behavior does not allow editing in Browse mode but does allow editing in Find mode so that a title is searchable.


Tooltips

Tooltips are an important layout feature in the FileMaker 9 product line. Specifically, you’ll need FileMaker Pro 9 Advanced to add tooltips to layouts, although anyone with regular FileMakerPro 9 can access and use them after you defined them. A tooltip is a small snippet of text that appears when a user hovers the mouse over a layout object (a data field, field label, button, or any other item that can be placed on a layout in Layout mode). The tooltip can provide information about the item beneath it, or it can be provide additional information about data in the database, among many possible uses.

To define a tooltip, select the layout object to which you’d like to attach the tooltip, and then choose Format, Set Tooltip. A dialog box appears, as shown in Figure 4.22.

Figure 4.22. Using FileMaker Pro Advanced, you can add an instructive tooltip to any object on a layout.

image

You can supply a simple text string as the tooltip. Note, though, that you can also use the Specify button, which enables you to define a calculation that is used to generate the tooltip text. The ability to have tooltip text derived from a calculation can lead to some elegant applications. Here are a few examples:

  • In a list or portal view of data, in which some data might be too wide for its column, add a tooltip to display the entire data value of the field.
  • Create contextual help. If you have Next Record and Previous Records links on a layout, create tooltips that will warn the user if there is no next or previous record (that is, they’re at the beginning or the end of the found set).
  • Create “smart” Next and Previous buttons that use the GetNthRecord() function to display some information about the next or previous record in the set.

image For more information on FileMaker’s GetNthRecord() function, seeGetNthRecord,” p. 471.

Tooltips are a standard feature of modern user interfaces. Because they are a relatively new addition to FileMaker Pro, you might want to add them whenever you work on an older solution.

image Troubleshooting

Copying and Pasting Fields Between Files

When I copy and paste fields from a layout in one file into another file, sometimes the fields retain their proper identity, sometimes they have no identity, and sometimes they have the wrong identity. Why is that?

When you copy fields from a layout in one file and paste them into another file, they might or might not retain their identity, as you’ve discovered. A field retains its identity when there exists a field in the destination file that has the same source table and field name as the source field. Additionally, the layouts must be based on identically named table occurrences. It’s not enough for the source tables to be named the same. If the table occurrences match, but no similarly named field is found in that table, the field displays <field missing> when it’s pasted into the destination file. If the table occurrence names don’t match, the field shows up without any identity in the destination file.

Given the ease with which you can copy and paste tables using FileMaker Pro 9 Advanced, we recommend first creating a compatible schema in the destination file, and then copying your layout objects.

Determining Which Records Will Be Displayed on a Layout

I created a table occurrence that’s supposed to display only invoices that are more than 60 days overdue. However, when I build a layout based on this table occurrence, I still see all the invoice records. What did I do wrong?

The problem here isn’t anything you’ve done or haven’t done, but rather your expectations. The table occurrence to which a layout is tied never determines which records from the source table are displayed on that layout. It merely determines the starting point on the Relationships Graph from which any action or object involving a relationship is evaluated. To view a set of related records, you must establish a perspective through which those records are viewed; in other words, you’ll need a portal.

If you have a layout that’s tied to an occurrence—any occurrence—of an Invoice source table, all the records from the Invoice table can be viewed from the context of that table occurrence. Think of it this way: A layout’s table occurrence doesn’t determine what records you can view from that layout; rather, it determines what records the records of that table can view. So, in the case of your table occurrence, which is supposed to show only invoices that are more than 60 days overdue, you’d need to view those via a portal from a layout tied, say, to a Customer table.

FileMaker Extra: Designing Cross-Platform–Friendly Layouts

One of the things that sets FileMaker apart from other database applications is that it runs on both Windows and Macintosh operating systems. You can even have a mixed platform of client machines. If you are developing a system that needs to run on both platforms, you need to keep a few design considerations in mind.

First, text blocks might be rendered slightly differently between platforms because of differences in the dots per inch (dpi) that each supports. Macintosh operating systems use 72 dpi, whereas Windows is built at 96 dpi. Font sizes are always described as 72nds of an inch regardless of platform, which means that a 12-point font takes up 12 pixels (12/72nds of 72) on a Macintosh monitor, but 16 pixels on a Windows monitor (12/72nds of 96). In either case, this represents 1/6th of an inch.

The problem is that graphics and other layout objects are set to be a precise number of pixels tall and wide. If, for instance, you have a text block or field on a layout that’s set to be 72 pixels wide, you’d be able to see fewer characters in that space on Windows. To account for this situation, you should make text blocks and buttons slightly oversized so that you don’t truncate characters on Windows.

Not all fonts available on one platform are supported on the other; platform-specific fonts should be avoided. Some fonts display different baselines on Mac and PC. Trebuchet, for example, is a particularly bad culprit. The text baseline determines where the bottom of a font appears within a text block. Different baselines could mean that letters that hang below the baseline (such as g, y, j, p) have their tails cut off. Verdana tends not to be so bad, but it’s a wide font and might consume too much horizontal space in a database. Lucinda is often a relatively safe font, if it is available to all your users. Tahoma also is mostly consistent between platforms. The combination of font and field box size is tricky, and you’ll just have to experiment. Note that 10-point Verdana with a 16-pixel field height tends to work well on both platforms, but it’s a very wide font. Use Arial/Helvetica if you’re pressed for space.

The other big cross-platform layout problem is the viewable size of your layouts. It’s generally desirable to create layouts on which users won’t need to scroll to see important information. Different operating systems, even within a platform, might have different viewable layout areas, even at the same monitor resolutions. Users who position their Dock or Start menu bar in different places compound the problem. Windows XP tends to be the “piggiest” consumer of screen real estate and represents your lowest common denominator for a given resolution.

In the end, of course, the best advice when developing cross-platform applications is simply to test everything early in your development process on all operating systems you plan to support. We also strongly urge you to create a template layout in which all your fonts are selected, your field sizes established, and layout size and window size set. Then rather than having to carefully duplicate these standards across your solution, simply start all new layouts by duplicating this template.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.144.194