<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Key-Controlled</title>
	<atom:link href="http://www.kegebein.net/blog/2009/08/key-controlled/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kegebein.net/blog/2009/08/key-controlled/</link>
	<description>Random thoughts about ideas, solutions, everything …</description>
	<lastBuildDate>Sun, 22 Aug 2010 17:51:55 +0200</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: chivalry</title>
		<link>http://www.kegebein.net/blog/2009/08/key-controlled/comment-page-1/#comment-14</link>
		<dc:creator>chivalry</dc:creator>
		<pubDate>Thu, 27 Aug 2009 17:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.kegebein.net/blog/?p=165#comment-14</guid>
		<description>Here&#039;s how I solve the same issue, which you might be interested in.

First of all, I use a custom function written by Mikhail Edoshin, BitIsSet( Number, Bit ).

// Returns whether or not the binary bit in the given number is turned on. i.e., ~BitIsSet( 16; 5 ) would return True as 16 is 10000 in
//   binary. Similarly, ~BitIsSet( 18; 2 ) would also return True as 18 is 10010 in binary. This calculation is thanks to Mikhail Edoshin
//   and is found at http://edoshin.skeletonkey.com/2005/11/custom_function.html.
//
// Written by Mikhail Edoshin

Mod( Div( Number; 2 ^ ( Bit - 1 ) ); 2 )

Next I have a set of custom functions that are simply constants, such as kModifierShift:

// Used as a named constant. Should have a value such that ModifierKeyIsActive( kModifierShift ) = True when the shift key is held down.

1

kModifierCapsLock is 2, kModifierControl is 3, etc, each value corresponding to the bit tha

t&#039;s true from GetActiveModifierKeys.

Finally, I have ModifierKeyIsActive( ModifierKey ), which accepts one of those constant custom functions:

// The ModifierKey parameter should be an integer between 1 and 5. These can be accessed via the kModifier* custom function
//   constants. Returns whether or not the given modifier key, as specified by it&#039;s power of two equivalent, is held down at the time
//   the function is evaluated.
//
// EXTERNAL REQUIREMENTS: The BitIsSet custom function. Easiest to use with the presence of the kModifier* custom function
//   constants.
//
// Written by Charles Ross

BitIsSet( Get( ActiveModifierKeys ); ModifierKey )

With the above, I get code that looks quite nice: If[ ModifierKeyIsActive( kModifierShift )]</description>
		<content:encoded><![CDATA[<p>Here&#8217;s how I solve the same issue, which you might be interested in.</p>
<p>First of all, I use a custom function written by Mikhail Edoshin, BitIsSet( Number, Bit ).</p>
<p>// Returns whether or not the binary bit in the given number is turned on. i.e., ~BitIsSet( 16; 5 ) would return True as 16 is 10000 in<br />
//   binary. Similarly, ~BitIsSet( 18; 2 ) would also return True as 18 is 10010 in binary. This calculation is thanks to Mikhail Edoshin<br />
//   and is found at <a  href="http://edoshin.skeletonkey.com/2005/11/custom_function.html" rel="nofollow">http://edoshin.skeletonkey.com/2005/11/custom_function.html</a>.<br />
//<br />
// Written by Mikhail Edoshin</p>
<p>Mod( Div( Number; 2 ^ ( Bit &#8211; 1 ) ); 2 )</p>
<p>Next I have a set of custom functions that are simply constants, such as kModifierShift:</p>
<p>// Used as a named constant. Should have a value such that ModifierKeyIsActive( kModifierShift ) = True when the shift key is held down.</p>
<p>1</p>
<p>kModifierCapsLock is 2, kModifierControl is 3, etc, each value corresponding to the bit tha</p>
<p>t&#8217;s true from GetActiveModifierKeys.</p>
<p>Finally, I have ModifierKeyIsActive( ModifierKey ), which accepts one of those constant custom functions:</p>
<p>// The ModifierKey parameter should be an integer between 1 and 5. These can be accessed via the kModifier* custom function<br />
//   constants. Returns whether or not the given modifier key, as specified by it&#8217;s power of two equivalent, is held down at the time<br />
//   the function is evaluated.<br />
//<br />
// EXTERNAL REQUIREMENTS: The BitIsSet custom function. Easiest to use with the presence of the kModifier* custom function<br />
//   constants.<br />
//<br />
// Written by Charles Ross</p>
<p>BitIsSet( Get( ActiveModifierKeys ); ModifierKey )</p>
<p>With the above, I get code that looks quite nice: If[ ModifierKeyIsActive( kModifierShift )]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
