<?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 Events and the Responder Chain: Sample Code using arrow keys in custom NSTextField</title>
	<atom:link href="http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/</link>
	<description>All Mac, All the Time</description>
	<lastBuildDate>Mon, 08 Mar 2010 18:44:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Matt</title>
		<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/comment-page-1/#comment-19185</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Mon, 22 Oct 2007 21:29:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/#comment-19185</guid>
		<description>hey, thanks a bunch, I have been creating (TRYING) a program, unfortunately, I am a noob so it takes me a while to make it but your tut was very helpful; about NSSteppers. If you want my program when I am done, email me at mamiller93@gmail.com :)</description>
		<content:encoded><![CDATA[<p>hey, thanks a bunch, I have been creating (TRYING) a program, unfortunately, I am a noob so it takes me a while to make it but your tut was very helpful; about NSSteppers. If you want my program when I am done, email me at <a href="mailto:mamiller93@gmail.com">mamiller93@gmail.com</a> <img src='http://www.macfanatic.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/comment-page-1/#comment-19077</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 19 Oct 2007 14:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/#comment-19077</guid>
		<description>Awesomeness, thanks for the code suggestions.  I&#039;ll be playing more with that if I ever find time to play in Cocoa instead of the devilish C++ that I&#039;m using for all my classes...</description>
		<content:encoded><![CDATA[<p>Awesomeness, thanks for the code suggestions.  I&#8217;ll be playing more with that if I ever find time to play in Cocoa instead of the devilish C++ that I&#8217;m using for all my classes&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r.</title>
		<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/comment-page-1/#comment-19052</link>
		<dc:creator>r.</dc:creator>
		<pubDate>Fri, 19 Oct 2007 03:55:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/#comment-19052</guid>
		<description>Whoops, the html form gremlins ate the rest of the code. I&#039;m sure you can figure out the rest of the down arrow case, and when that&#039;s done just return result. For bonus points check to make sure stepper is valid before using it.</description>
		<content:encoded><![CDATA[<p>Whoops, the html form gremlins ate the rest of the code. I&#8217;m sure you can figure out the rest of the down arrow case, and when that&#8217;s done just return result. For bonus points check to make sure stepper is valid before using it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r.</title>
		<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/comment-page-1/#comment-19051</link>
		<dc:creator>r.</dc:creator>
		<pubDate>Fri, 19 Oct 2007 03:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/#comment-19051</guid>
		<description>Here&#039;s a way cleaner version that works on keyDown, supports autorepeat, doesn&#039;t affecting the insertion point or selection, _and it does away with all your string conversion funkiness.

-(void)awakeFromNib {
	[self setIntValue:1];
	
	[self setDelegate:self];
}


-(BOOL)
control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
	BOOL result = NO;
	
	if (command == @selector(moveUp:)) {										// up arrow pressed
		double increment = [self doubleValue] &gt;= [stepper maxValue] ? [stepper minValue] : [self doubleValue] + [stepper increment];
		[self setIntValue:increment];
		
		result = YES;
		
	} else if (command == @selector(moveDown:)) {								// down arrow pressed		
		double decrement = [self doubleValue] </description>
		<content:encoded><![CDATA[<p>Here&#8217;s a way cleaner version that works on keyDown, supports autorepeat, doesn&#8217;t affecting the insertion point or selection, _and it does away with all your string conversion funkiness.</p>
<p>-(void)awakeFromNib {<br />
	[self setIntValue:1];</p>
<p>	[self setDelegate:self];<br />
}</p>
<p>-(BOOL)<br />
control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {<br />
	BOOL result = NO;</p>
<p>	if (command == @selector(moveUp:)) {										// up arrow pressed<br />
		double increment = [self doubleValue] &gt;= [stepper maxValue] ? [stepper minValue] : [self doubleValue] + [stepper increment];<br />
		[self setIntValue:increment];</p>
<p>		result = YES;</p>
<p>	} else if (command == @selector(moveDown:)) {								// down arrow pressed<br />
		double decrement = [self doubleValue]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r.</title>
		<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/comment-page-1/#comment-18825</link>
		<dc:creator>r.</dc:creator>
		<pubDate>Sat, 13 Oct 2007 00:54:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/#comment-18825</guid>
		<description>Actually your code as provided does not work on a laptop, which has no numeric keypad. Since the codes you&#039;re matching on are NS*FunctionKey types, I replaced the mask with NSFunctionKeyMask and that seems to work fine.</description>
		<content:encoded><![CDATA[<p>Actually your code as provided does not work on a laptop, which has no numeric keypad. Since the codes you&#8217;re matching on are NS*FunctionKey types, I replaced the mask with NSFunctionKeyMask and that seems to work fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: r.</title>
		<link>http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/comment-page-1/#comment-18824</link>
		<dc:creator>r.</dc:creator>
		<pubDate>Sat, 13 Oct 2007 00:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.macfanatic.net/blog/2007/01/01/key-events-and-the-responder-chain-sample-code-using-arrow-keys-in-custom-nstextfield/#comment-18824</guid>
		<description>Thanks for the sample code..</description>
		<content:encoded><![CDATA[<p>Thanks for the sample code..</p>
]]></content:encoded>
	</item>
</channel>
</rss>
