The first FileMaker database you looked at (the Contact Management template on Section 1.2.1) has a pretty slick system for switching between list and detail layouts. Instead of fiddling with the tiny Layout pop-up menu, you can just click tab graphics right on the screen. Each click magically transports you to a different layout. (Of course, at the time you didn't know it was changing layouts. You didn't even know what a layout was. But the buttons still made sense to you.)
You can easily duplicate this magic in your own databases. Just use FileMaker's Button tool, shown in Figure 6-32. But don't let the tool's name and appearance mislead you. You're not limited to the rectangular beveled buttons this tool creates. In fact, you can turn any object on a layout into a buttonan imported graphic or even a field. When your users click the mouse button while pointing to such an object, FileMaker highlights it so they know they're about to perform some kind of action. When they let go, something happens. You get to decide what that something is.
|
|
6.7.1. Creating Buttons with the Button Tool
You want to add a Go to List button to the detail layout in your People database, so open the database now and switch to the detail layout.
To add a button, first click the Button tool. Then draw the button on the layout as though you were drawing a rectangle. Figure 6-33 shows you where you might want to put it.
|
When you release the mouse button, FileMaker immediately pops up the Button Setup dialog box (Figure 6-34).
|
You want this button to switch to a different layout whenever someone clicks it, so find Go to Layout in the action list and select it (it's right under the boldface Navigation item). When you do, the Options area shows you a pop-up menu labeled Specify. You can pick any layout in your database from this menu. For this button, choose List.
If you're picky about such things, you can even control whether your button has square corners or slightly rounded corners. Choose the "Rounded button" option for an elegant, classy look. (If you don't make a choice, square is what you get.)
Something else changes when you select a button command: The "Change to a hand cursor over button" checkbox appears below the Button Style area. By turning this option on, you tell FileMaker to use a special pointing-finger cursor whenever someone mouses over the button. (The icon is similar to the one you usually see when you point to a link in a Web browserthe universal cue that an area is clickable.)
When you're done making choices, click OK. You can now switch to Browse mode and give your button a try.
Note: Buttons work in Browse mode and Find mode, but not in Preview mode (Section 2.9).
6.7.2. Turning an Existing Layout Object into a Button
Buttons are handy, but they can be redundant. Often, there's already something on your layoutlike a picture or even a fieldthat would make a perfectly good button. For example, if you've got your company's logo in the top-right corner of the layout, you can make it link to the main page of your Web site. A separate button reading "Go to Home Page" would be unnecessary clutter. (Incidentally, in this case you would use the Open URL button action; see Section 14.9.)
Here's another common example: Now that you have a button that goes from the detail layout to the list layout (Section 5.3.2), you might want to give folks an easy way to get back where they came from. Rather than add a button to the already full body part on the list layout, why not turn the person's name into a link of sorts? When you click the name, FileMaker shows you details on that person.
Turning one of a record's existing fields into a button capitalizes on the fact that FileMaker always selects a record when you click it in list view. And when you switch layouts, it always stays on the same record no matter which layout you use. This time you've added a button to the works, but the original behavior is unchanged: Clicking the list switches records, and the button switches layouts.
Here's how:
This is the object you want to turn into a button. You have to select it before you can work on it.
new button. Instead, you're turning the selected object into a button.
This action tells the button which layout it should go to.
|
The window disappears and you're back on your layout. You don't see a change because you can't normally see if an object has been turned into a button. If you try the button now, it works fine, but it doesn't do your users much good if they don't know it's there. To make it obvious that the name links to the detail layout, why not make it look like a link.
Using any of FileMaker's text formatting tools (Section 4.4.6.2), turn the text blue and give it an underline (Format Text Color and Format images/U2192.jpg border=0> Style images/U2192.jpg border=0> Underline).
If you need a bunch of buttons on your layout, you can use the technique outlined on Section 4.4.6.2 on several buttons at once. Just select all the objects that you want to button-ize before you choose the Format Button command. FileMaker automatically groups the objects and turns the entire group into a button. These objects now act like any other grouped objects: Anything you do to one in Layout mode happens to all of them. If you later Warning: If you want four different buttons that do the same thing (so you can work with them individually), you have to button-ize them one at a time.
6.7.3. Making a Button not a Button
If you have a layout object that's already a button, and you don't want it to be a button anymore, you need a way to turn off its button-ness. It's easy to do but not very intuitive: Select the button and choose Format Button Setup (or double-click the button). In the Button Action list (Figure 6-35), choose Do Nothing, and then click OK. Now the object isnt a button anymore.
You can even remove the button action from the "real" buttons you create with the button tool (Section 4.4.4.2). That's because, in reality, the button tool just creates a specially formatted text object and automatically turns it into a button. If you switch it to Do Nothing, you're just left with a fancy text object. (You might want to deactivate a button when you're troubleshooting your database…or for a little April Fool's Day fun.)
6.7.4. Button Actions
The Specify Button window has dozens of available actions, as you can see at the left side in Figure 6-35. In the previous section, you created buttons for the Go to Layout action, but there are many more. As you scan through these commands, you probably notice that many of them repeat the same functions you find in File-Maker's menus. That's not just meaningless redundancy. By giving your databases buttons for lots of everyday commands, you can make FileMaker even easier to use than it already is. Design some icons (perhaps in your corporate colors), attach buttons to them, and you may find that you hardly have to train your colleagues at all, because the buttons and their labels help explain what they need to do to use the database.
POWER USERS' CLINIC New Tab Orders |
Buttons are user-friendly by their very nature. But you can make them even easier to use by including them in a layout's tab order (see Section 6.4). When a button is in the tab order, your users can operate the button by tabbing to it, then tapping the Space bar or Return key to "press" it. As they tab, they can see which button is active by the double line around it. That means it's waiting for a press. Be careful where in the tab order you put buttons, though. If you mix fields and buttons together without careful testing, your database may make people feel like they're held captive in a pinball machine. If your goal is to make users' lives easier, consider putting all your buttons together in the tab order, followed by all the fields, or vice versa. Tab-able buttons take a certain amount of planning, so File-Maker doesn't take the liberty of putting them in the tab order for you. They don't appear in the order unless you specifically tell FileMaker that's what you want in the Set Tab Order dialog box (Section 6.4). Here's how the box's options work.
|
Here's a brief rundown on what some of these actions do.
6.7.5. Go to Layout
Go to Layout is the action you used for the two buttons you created earlier in this chapter. It transports those who click it to another layout instantly. You get to pick which layout to visit (Section 6.7.2).
6.7.6. Go to Record/Request/Page
The Go to Record/Request/Page action lets you switch to the Next, Previous, First, or Last record in the found set. If you're in Find mode, it navigates find requests instead. Despite the word "Page" in its name, it doesn't navigate pages in Preview mode because buttons don't work in Preview mode. (The reason it has this name is because you can navigate pages with a script in Preview mode. See Chapter 13 for more.)
6.7.7. Go to Field
Use Go to field if you want a button that delivers its clickers into a specific field. You get to pick the field by clicking the Options area's Specify button. For example, you could create a button that says "Back to Square One" that places the cursor in the first field in the tab order. (If you don't pick a field, this step goes to no field. In other words, it gets the user out of whatever field she's in.)
The Options area also has a "Select/perform" checkbox. For text, number, date, time, and timestamp fields, turn on this option if you also want FileMaker to select the contents of the field, so folks can just start typing to replace it. For container fields, this option tells FileMaker to perform the field contents. In other words, play the movie or sound, open the file, and so forth. This way, you could have a button that opens up a file (Section 2.7.5), stored in a container field. For the Go to Field action to work, the target field must be on the layout.
6.7.8. Go to Next Field and Go to Previous Field
The Go to Next Field and Go to Previous Field actions have no options at all. They simulate the Tab and Shift-Tab keystrokes, bouncing to the next or previous field in the tab order.
6.7.9. Enter Browse Mode, Enter Find Mode, and Enter Preview Mode
The last three actions in the Navigation sectionEnter Browse Mode, Enter Find Mode, and Enter Preview Modedo just what you'd expect. Want a Find button on your layout? Assign it the Enter Find Mode action and you're done.
6.7.10. Editing Actions
FileMaker has seven editing actions, whose names are largely self-explanatory:
The Undo action takes no options at all; it simply runs the normal Edit images/U2192.jpg border=0> Undo menu command. Select All also has no options. It works exactly like the Edit images/U2192.jpg border=0> Select All command.
Cut, Copy, Paste, and Clear all let you optionally specify the field to act on. If you don't give a field, they act on the field your user is in when he clicks the button. You can also turn on "Select entire contents" for these actions if you want FileMaker to do a Select All before it cuts, copies, pastes, or clears. Again, if you don't, it works on whatever the user has already selected.
Perform Find/Replace lets you pop up the Find/Replace dialog box. You can click Specify to preload the dialog box with your own choices. And you can turn on "Perform without dialog" if you want it to perform your user's Find/Replace choices without showing the dialog box at all.
6.7.11. Field Actions
In the Fields section you find several useful and familiar commands.
Insert Text lets you stick predetermined text into a field. You can tell FileMaker which field to put it in, or leave "Go to target field" unchecked to have it land in the field the user's currently in. You also get a "Select entire contents" checkbox if you want the inserted text to replace whatever's in the field. Click the bottom Specify button to tell FileMaker what text to insert.
Several actions mimic the choices in the Insert menu (in Browse mode):
For each of these, you can optionally choose the field to use, and whether or not to select everything in the field before inserting.
Finally, the Replace Field Contents action runs the Records Replace Field Contents command. This time, you get to pick the field to replace into if you want. You can also predetermine what goes in the Replace Field Contents dialog box. If you turn on "Perform without dialog," your users never even see the dialog box. Instead, the replace 6.7.12. Record Actions
Use the New Record/Request action to make a button create a new record. To duplicate the current record instead, choose Duplicate Record/Request. To delete a record, use Delete Record/Request. This action has one option: "Perform without dialog." Turn this action on if you want your button to delete the record with no warning message.
The Open Record/Request action locks the record without actually entering any fields. Chances are you never need to do this action from a button.
Use Revert Record/Request to mimic the Records Revert Record menu command. This one has a "Perform without dialog option as well.
To give folks an obvious Save button, assign it to the Commit Record/Request action. This action is just like clicking out of the record. It's useful, though. If you have your layout set to show a "Do you want to save…" message whenever someone edits the record, you can add a Save button to the layout, using this command with the "Perform without dialog" option turned on. Whenever anyone clicks the button, FileMaker saves the record straightaway without the annoying dialog box.
6.7.13. Found Set Actions
If you have certain finds that you perform a lot, you can create buttons to run them directly. Use the Perform Find, Constrain Found Set, and Extend Found Set actions to get the job done. Each action lets you specify what find requests you want them to use. See Section 1.6.3.1 for an explanation of how to specify these requests manually.
For now, though, you can easily use them like this: First, perform the find you want the button to do (just go to Find mode, enter your criteria, and click Find). Then add the button to the layout and pick one of the find actions. Turn on "Specify find requests" and FileMaker shows you its complicated Specify Find Requests dialog box. But the box already has the requests you used last, so you can just click OK. Now your button performs the right find.
The last few actions work just like their counterparts in the Records menu:
6.7.14. Window Actions
Windows are, after all, where FileMaker displays your information, so it pays to be familiar with the button commands that control them. With these actions, you can adjust an open window so your data fits more comfortably, or even create a new window to navigate in while the form stays intact in the background.
You can scroll a window while you're in a field. If you do, the field you're in may no longer be visible on the screen. The Scroll Window action's To Selection option tells FileMaker to scroll the window so that the field you're in is visible.
6.7.15. Print Actions
The Files section has two important actions: Print Setup and Print. These give you control over the File Print and File images/U2192.jpg border=0> Print Setup or File images/U2192.jpg border=0> Page Setup commands. Optionally, you can preselect the options in each dialog box, and use the "Perform without dialog checkbox to perform the action with no user intervention. You could, for instance, have buttons that switch to landscape and portrait page layouts, and a third button to directly print the current record.
6.7.16. Open Actions
The Open Menu Item section gives you button access to several common dialog boxes. You can add them to a layout to save people a trip to the menu bar…especially useful if they don't know where the menu bar is.
6.7.17. Exiting FileMaker
If you want a button that exits or quits FileMaker itself, use the very last action in the list: Exit Application.
Part I: Introduction to FileMaker Pro
Your First Database
Organizing and Editing Records
Building a New Database
Part II: Layout Basics
Layout Basics
Creating Layouts
Advanced Layouts and Reports
Part III: Multiple Tables and Relationships
Multiple Tables and Relationships
Advanced Relationship Techniques
Part IV: Calculations
Introduction to Calculations
Calculations and Data Types
Advanced Calculations
Extending Calculations
Part V: Scripting
Scripting Basics
Script Steps
Advanced Scripting
Part VI: Security and Integration
Security
Exporting and Importing
Sharing Your Database
Developer Utilities
Part VII: Appendixes
Appendix A. Getting Help