[Forums] [Shop] [Resources] [Training] [About] [Solutions] [Consulting] [News] [Links]

Questions s I hope you enjoy this FREE online training. Let me know if you'd like to see more! You can email me at jmo@filemakerpros.com. And, if you really like this online training, consider one of my live classes based on my wildly popular book and CD ROM. Happy FileMaking!

Savvy Buttons

You want to include warning messages for beginners so they don't accidentally click a button that does something they don't want. For instance, you might have an archive button that exports records and then deletes them. This is a good candidate for a button with a warning message on it. However, once your users become savvy, they will become annoyed with the warning message.

Your best solution is to use the Status(CurrentModifierKeys) function in your script. This function can determine if one or several keys are held down. Here is the list of keys that FileMaker can identify:

Macintosh:

Shift = 1
Caps Lock = 2
Control = 4
Option = 8
Command/Apple = 16

Windows

Shift = 1
Caps Lock = 2
Ctrl = 4
Alt = 8

NOTE: You can trap for multiple keys being held down. Just add up their values and check for that number (e.g. Shift + Caps Lock = 3).

Notice that some of the keys on the Macintosh are the same as on Windows, but some are different. For this example, we'll use the Shift key since it is common to both platforms. To test for this key, you need to use a Script with an If statement.



If the Script detects the Shift key, only the steps outside the If statement will be performed. If the Shift key is not held down, a message will appear warning the user. If they click the Okay button, the rest of the script will run. If they click the Cancel button, the Script will halt.



Here is what the final product looks like.



NOTE: The Status(CurrentModifierKeys) function is only available in FileMaker Pro 4.0 and later.

HOT TIP: You can use the Status(CurrentModifierKeys) function to create balloon help! If a modifier key is held down while clicking a button, it will display a message describing what the button does rather than performing the action.

Download an example FileMaker file  Mac  Win .

DONE


Exclamation s Database Pros offers training classes across the globe. Classes include the wildly popular Intermediate and Advanced Scriptology training series.


Database Pros