Wednesday, March 25, 2009

Modifier Key

Modifier Key

CATEGORY: Calculations
CLASS: Functions

You can branch a calculated result (and there by a script using the calculation) by holding down a modifier key on the keyboard. The branching of the calculation also requires the use of the Get(ActiveModifierKeys) function, which will return a number result depending on the key held down. If more than one key is held down, the function results the sum value of each key.

The individual values for each key is

Shift = 1,
Caps Lock = 2,
Ctrl (Windows) and Control (Mac OS) = 4,
Alt (Windows) and Option (Mac OS) = 8
Command (Mac OS) = 16.

If a user was holding down the shift and the Ctrl keys, the function would return 5. This is the sum of the two key ( Shift = 1 ) + ( Ctrl = 4).

You may have a button on your FileMaker screen that performs a hidden operation, such as delete this record, go to an otherwise hidden place or perform a script. For example, you could make the “New Record” button delete the current record if the user holds down the shift key. This is done by using a script that branches based upon what it sees via the Get(ActiveModifierKeys) function.

If [ Get(ActiveModifierKeys) = 1]
Delete Record
Else
Create New Record
End If

In our office, we have a client that we have a scripted feature in place that if you hold down the shift key when clicking the header graphic of the layout, it installs the FileMaker default menu set. Otherwise, the user has a more limited menu set that does not have options like deleting or exporting records. We use an extended privilege in concert with this setting and call it the “shift click club”. We do audit when the shift click is used and it has worked out very well for us and our client.

Here are some links to other posts that might be of interest in regards to this topic...
Command Key
EXAMPLE: Enter Into A Field If ...
EXAMPLE: Holding Down Modifier Keys

ADVERTISEMENT ==================
Help support this blog by considering a donating to its ongoing growth. For more details, please visit http://www.dwaynewright.com/donate.html