GetKeys ( )

Function stats

Average user rating
37
96
9999
Support
FileMaker 7.0 +
Date posted
05 December 2008
Last updated
15 May 2009
Version
Recursive function
No

Author Info
 Fabrice

74 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

GetKeys  (  )


Parameters

No parameters for this function.


Description

Tags:  debug  

returns a list of keys held by user (Shift, Caps Lock, Control, Alt, Command)
like Get ( ActiveModifierKeys ), but readable :-)

Examples

Sample input

GetKeys


Sample output

Alt¶Shift

 

Function code

/*
GetKeys
by Fabrice Nordmann

v.1.0 May 18th, 2008

returns a list of keys held by user (Shift, Caps Lock, Control, Alt, Command)
like Get ( ActiveModifierKeys ), but readable :-)
*/

Let ([
$x = Get ( ActiveModifierKeys )
; t = Case ( $x >= 16 ; Let ([ $r = "Command" ; $x = $x - 16 ]; "" ))
; t = Case ( $x >= 8 ; Let ([ $r = List ( $r ; "Alt" ) ; $x = $x - 8 ]; "" ))
; t = Case ( $x >= 4 ; Let ([ $r = List ( $r ; "Control" ) ; $x = $x - 4 ]; "" ))
; t = Case ( $x >= 2 ; Let ([ $r = List ( $r ; "Caps Lock" ) ; $x = $x - 2 ]; "" ))
; t = Case ( $x = 1 ; Let ([ $r = List ( $r ; "Shift" )] ; "" ))
]; $r & Let ( $r = "" ; "" )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/96

    Prototype: GetKeys( )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 15 May 2009
    Version: 1.1

*/
// ===================================

 

Comments

Genx
05 December 2008



This one is quite cool. One idea though is an optional parameter - a pilcrow delimited list of button names - if it's provided then the function should return true or false based on whether all those buttons are currently being held down.

What do you think?
     Feature request
Fabrice
05 December 2008



So you look at it the other way around... I'm sure you'll like Peter Wagemans' function KeysDown http://www.briandunning.com/cf/473<br />
I prefer to have it this way, and then you can do<br />
FilterValues ( yourPilcrowDelimitedList ; GetKeys ()) = yourPilcrowDelimitedList<br />
and it will return 1 or 0. I think it's all a matter of taste ;)
(Edited by Fabrice Nordmann on 05/12/08 )
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)