Working with Buttons on Layouts

 <  Day Day Up  >  

Working with Buttons on Layouts

More often than not, clickable layout objects are graphical buttons, but it is possible to attach a script to anything you can place on a layout: a field, a graphic, even a portal. These layout objects then become "button-like," so that when a user clicks such an object, the object's associated script runs.

Creating buttons on FileMaker layouts is fairly straightforward. You can opt to use the button tool to draw a 3D-esque button, or you can attach a button behavior to any object on a layout (including fields, merge fields, text, images, and even binary files pasted onto layouts).

Apply button behaviors to an object by either right-clicking and choosing Specify B utton, or, with a layout object selected, navigate to the format menu and choose B utton.

We've talked about buttons as a tool for triggering scripts. This is actually a little inaccurate. A button, when clicked, can perform any single script step: Go To Layout , for example, or Hide Window . Of course, one of the available script steps that you can attach to a button is Perform Script . Choose that option, and your button can perform a script of any length or complexity.

Given that fact, when adding interactivity to a button, why use any of the other single script steps other than Perform Script itself? Well, we're going to argue that you shouldn't. If you use single script steps, you're out of luck if you ever want a button to do two things, and you're out of luck if you create a bunch of buttons that perform the same step (such as Go to Layout ) and you need to change them all ”it's insufficient abstraction to not allow the same button behavior to be reused elsewhere. Because it's likely that you will want to add steps, or duplicate a button and edit its behavior globally, you should ignore every button behavior other than Perform Script. Even if a script is one step long and is likely never to be reused, still take the few extra seconds to create a script. If the button performs a script, you can easily add steps whenever you need them, and all the buttons that need to go to, say, the Invoice layout can be changed at once. After you've selected the script in question, you can opt to modify the behavior of the script that may or may not be currently running.

For more details on controlling script flow via button attributes, see "Script Parameters," p. 422 .


 <  Day Day Up  >  


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

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