Adding Buttons

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.

Figure 6-31. This window has nine container fields, all set to crop the same image. Each one has its alignment set differently. For example, the top-right field is set to align its picture in the top-right, and the center container has Center selected in both alignment pop-up menus. When an image is cropped, the alignment settings tell FileMaker which part of the picture you want to see. Top-right alignment tells FileMaker to show the middle of the picture, cropping out everything around it.

Figure 6-32. When you're in Layout mode, you find the Button tool in the status area, right about…there. It looks like a little button being poked in the face by its big brother…or being clicked…or something.


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.

Figure 6-33. You can put your button anywhere you want, and make it any size you want to. But if it's going to look like a button with the Go to List label, it should be close to the size of the button shown here.

When you release the mouse button, FileMaker immediately pops up the Button Setup dialog box (Figure 6-34).

Figure 6-34. The Button Setup dialog box shows up whenever you create a new button. You get to pick one action from the Button Action list. Most actions require a little configuration. When you pick one, its options appear in the Options area. You can come back to this box and make changes to an existing button: just double-click the button in Layout mode (or choose Format images/U2192.jpg border=0> Button) to open it.

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:

  1. If necessary, switch to Layout mode and to the list layout. Then, select the text object that holds the First Name and Last Name merge fields.

    This is the object you want to turn into a button. You have to select it before you can work on it.

  2. Choose Format Button Setup.

    new button. Instead, you're turning the selected object into a button.

  3. Choose the Go to Layout button action. When the Options area shows the Specify pop-up menu, choose Detail.

    This action tells the button which layout it should go to.

    Figure 6-35. Your list layout (in Browse mode) should look something like the top window. When you point to a name, your mouse arrow changes to the little hand icon, and when you click, the name highlights. After the button is released, you see the detail layout for the correct person, as shown in the bottom window.

  4. Click OK.

    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.

    Note: When you're in Layout mode, you can choose View Show images/U2192.jpg border=0> Buttons. When this option is turned on, FileMaker outlines every button with a thick dotted line (it shows up only in Layout mode). Choose the same command again to turn it off.

    Using any of FileMaker's text formatting tools (Section, 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 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.

    Tip: Here's a faster way, even though it's cheating. Just click a button and choose the Arrange Ungroup command (or better yet, press Ctrl+Shift+R or Shift--R). Even if the button isn't part of a group, FileMaker pops open a message box asking if you want to remove the buttons. Just click OK, and your object is no longer a button.

    You can even remove the button action from the "real" buttons you create with the button tool (Section 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.

    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.

    • The Add Remaining option lets you select a whole category of items to add to the tab order. The choices are Objects (both fields and buttons), Fields Only, or Buttons Only. Select the category you want, and then click the Add button. That tells FileMaker add to the tab order any object that doesn't already have a number in its arrow. Remember: FileMaker adds objects from top left to bottom right. If you want a custom order, click the arrows and type the number you need for each object.
    • The Remove option lets you remove All Fields or All Buttons from the tab order. Make the selection you want from the pop-up menu, and then click the Remove button. This is most useful when you've got a messy order that needs some wholesale revision. If you've got buttons and fields all jumbled together, you don't have to hunt for each item individually. Just tell FileMaker which category you're looking for, click remove, and start fresh.

    Here's a brief rundown on what some of these actions do.

    Note: This section explains the button actions you're ready to use right now. Many available actions simply won't make sense to you until you've learned more about FileMaker. These buttons mimic the steps you can use when you write scripts to automate FileMaker procedures. (In fact, you can use any button action in a script.) You'll learn about scripts in detail in Part 5.

    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.

    Note: The Enter Find Mode button has a "Specify find requests" option. You can use this power-user feature to preload the find requests and save your database's searchers a little time. You'll learn all about how to do this in Chapter 13.

    6.7.10. Editing Actions

    FileMaker has seven editing actions, whose names are largely self-explanatory:

    • Undo
    • Cut
    • Copy
    • Paste
    • Clear
    • Select All
    • Perform Find/Replace

    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.

    Note: The Editing section also has an action called Set Selection. You're not ready for this one yet, but it's covered in Chapter 14.

    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):

    • Insert from Index
    • Insert from Last Visited (Insert From Last Visited Record)
    • Insert Current Time
    • Insert Current User Name
    • Insert Picture
    • Insert QuickTime
    • Insert File

    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.

    Tip: Turn off the warning message only if the people using your database are very experienced (or very trustworthy). The Undo command can't undo a deletion, so there's no going back. Yet another reason for a good backup routine.

    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 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:

    • Modify Last Find
    • Show All Records
    • Show Omitted Only
    • Omit Record
    • Omit Multiple Records (This action has two options: how many records to omit, and the now-familiar "Perform without dialog.")
    • Sort Records (This one also lets you predetermine the desired sort order, and avoid the dialog box if you want.)
    • Unsort Records

    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.

    • Use New Window to make a button that creates a new window. You can determine its name, size, and position, but it always shows the layout you're already on, so its usefulness is pretty limited. It's more typically used in a script.
    • The Select Window action lets you switch to a different window if you know its name. Click Specify, choose Window Name, and type in the name of the window. (The Current Window option only makes sense when scripting.)
    • Close Window simply closes the active window. You can also supply the name of another window, and FileMaker closes that window instead.
    • The Scroll Window action gives the button rudimentary control over the window's scroll bars. Choose Home to scroll to the very top. If you choose End, a button click scrolls to the very end. Page Up and Page Down work like scroll bar clicks, moving it one screenful up or down.

      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.

    • Use Show/Hide Status Area and Show/Hide Text Ruler to show or hide each embellishment. Your button can explicitly show or hide the item, or you can choose Toggle to have the button switch the setting with each click. The Show/Hide Status Area action also has a Lock checkbox. Turn this checkbox on if you want the Status Area control to become inactive when your button is clicked. With an inactive Status Area control, nobody can show or hide the status area without using your buttons.-
    • The Set Zoom Level action lets you make your own Zoom buttons as well. This action also has a Lock option if you want to lock out the normal Zoom control. You also get a list of actions that perform menu commands:

      • Adjust Window lets you Minimize, Maximize, Resize to Fit, Restore (to its last size), or Hide the front most window.
      • Arrange All Windows gives you the Tile Horizontally, Tile Vertically, Cascade, and Bring All to Front options from the Window menu.
      • View As has an option for View as Form, View as List, and View as Table. You can also choose Cycle to have one button that cycles through all three views.

    Note: The options to lock the status area and zoom controls might seem a little odd for button actions. Why would a person ever click a button to lock herself out of something useful? Actually, you'll usually use these options as part of a script (Chapter 13). You see them here since button actions and script steps always have the same options.

    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.

    • Open Preferences
    • Open File Options
    • Open Define Database
    • Open Define Value Lists
    • Open Find/Replace
    • Open Help

    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.

    Tab Panels

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


Exporting and Importing

Sharing Your Database

Developer Utilities

Part VII: Appendixes

Appendix A. Getting Help

show all menu

FileMaker Pro 8. The Missing Manual
FileMaker Pro 8: The Missing Manual
ISBN: 0596005792
EAN: 2147483647
Year: 2004
Pages: 176
Similar book on Amazon © 2008-2017.
If you may any questions please contact us: