<?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: Cocoa Tutorial: Link Arrows, Part 2</title>
	<atom:link href="http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/</link>
	<description>fill the void</description>
	<lastBuildDate>Mon, 30 Jan 2012 09:42:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: bdunagan</title>
		<link>http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/comment-page-1/#comment-2310</link>
		<dc:creator>bdunagan</dc:creator>
		<pubDate>Fri, 31 Jul 2009 19:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=95#comment-2310</guid>
		<description>Wow, very helpful comments, Rowan! Thanks for posting these. When I finally have a chance to add this feature to Retrospect, I&#039;ll go with your way.

And fantastic job on Sequel Pro! It looks really professional.</description>
		<content:encoded><![CDATA[<p>Wow, very helpful comments, Rowan! Thanks for posting these. When I finally have a chance to add this feature to Retrospect, I&#8217;ll go with your way.</p>
<p>And fantastic job on Sequel Pro! It looks really professional.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rowan Beentje</title>
		<link>http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/comment-page-1/#comment-2170</link>
		<dc:creator>Rowan Beentje</dc:creator>
		<pubDate>Tue, 21 Jul 2009 22:20:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=95#comment-2170</guid>
		<description>One more update: using only hitTestForEvent, you may see your actions fired multiple times for multiple mouse events during one click.  For buttons which behave like OS X buttons - highlight states, and the ability to drag the mouse off the button while clicking to cancel the click - hitTestForEvent should return NSCellHitTrackableArea, and then trackMouse:inRect:ofView:untilMouseUp: can be used to handle the actual click action.

http://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPTextAndLinkCell.m may prove useful to anyone else, as a corollary to your very useful examples above!</description>
		<content:encoded><![CDATA[<p>One more update: using only hitTestForEvent, you may see your actions fired multiple times for multiple mouse events during one click.  For buttons which behave like OS X buttons &#8211; highlight states, and the ability to drag the mouse off the button while clicking to cancel the click &#8211; hitTestForEvent should return NSCellHitTrackableArea, and then trackMouse:inRect:ofView:untilMouseUp: can be used to handle the actual click action.</p>
<p><a href="http://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPTextAndLinkCell.m" rel="nofollow">http://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPTextAndLinkCell.m</a> may prove useful to anyone else, as a corollary to your very useful examples above!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rowan Beentje</title>
		<link>http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/comment-page-1/#comment-2119</link>
		<dc:creator>Rowan Beentje</dc:creator>
		<pubDate>Sat, 18 Jul 2009 17:16:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=95#comment-2119</guid>
		<description>Thanks a lot for the code!

I used this as a base to write an implementation for Sequel Pro ( http://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPTextAndLinkCell.m ) which largely achieves the same functionality, but may be helpful to others as an example of how to set different images for different states (highlighted, background etc) and how to retrieve the clicked cell row and column indexes.

However, the reason I&#039;m commenting here is that because I note you left out the dealloc method.  This is possibly because as soon as you added it, you started getting crashes? Table cells are cloned all over the place to preserve memory, but by default the copyWithZone will create a reference to internal objects; so if a copied cell is then deallocated, any retained objects (linkArrow in the code above) will be released and no longer usable by the original cell, causing crashes.

For anyone else running into this problem: override copyWithZone: to copy retained objects rather than simply referencing them, after which deallocation will work again. :)

(Apologies if this is all obvious - it really wasn&#039;t to me!)</description>
		<content:encoded><![CDATA[<p>Thanks a lot for the code!</p>
<p>I used this as a base to write an implementation for Sequel Pro ( <a href="http://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPTextAndLinkCell.m" rel="nofollow">http://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPTextAndLinkCell.m</a> ) which largely achieves the same functionality, but may be helpful to others as an example of how to set different images for different states (highlighted, background etc) and how to retrieve the clicked cell row and column indexes.</p>
<p>However, the reason I&#8217;m commenting here is that because I note you left out the dealloc method.  This is possibly because as soon as you added it, you started getting crashes? Table cells are cloned all over the place to preserve memory, but by default the copyWithZone will create a reference to internal objects; so if a copied cell is then deallocated, any retained objects (linkArrow in the code above) will be released and no longer usable by the original cell, causing crashes.</p>
<p>For anyone else running into this problem: override copyWithZone: to copy retained objects rather than simply referencing them, after which deallocation will work again. <img src='http://www.bdunagan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(Apologies if this is all obvious &#8211; it really wasn&#8217;t to me!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdunagan</title>
		<link>http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/comment-page-1/#comment-20</link>
		<dc:creator>bdunagan</dc:creator>
		<pubDate>Sat, 22 Nov 2008 02:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=95#comment-20</guid>
		<description>Actually, your approach is more elegant and generic than mine, as you can set the cell&#039;s action based on the controller context. Thanks for pointing that out. :)</description>
		<content:encoded><![CDATA[<p>Actually, your approach is more elegant and generic than mine, as you can set the cell&#8217;s action based on the controller context. Thanks for pointing that out. <img src='http://www.bdunagan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Mullen</title>
		<link>http://www.bdunagan.com/2008/11/10/cocoa-tutorial-link-arrows-part-2/comment-page-1/#comment-19</link>
		<dc:creator>Robert Mullen</dc:creator>
		<pubDate>Thu, 20 Nov 2008 17:46:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=95#comment-19</guid>
		<description>Thanks for the code, I have been using this sort of thing in my app after following a different thread and running into the exact same issues you address here. I did make a minor change to your code though but it may be because I am handling things improperly in my controllers. I don&#039;t hit a URL with the arrow click I actually use it to switch out views in a context sensitive manner. For that reason your code at line 51:

    [[NSApp delegate] openURLInBrowser:nil];  

doesn&#039;t fit my app. I changed that line to:

    [self performClick:nil];

in the subclass and then use setAction in the tableView:willDisplayCell:forTableColumn:row to point to the controller specific selector for the context. Works like a charm but may not be useful or properly designed. I am still pretty new to Cocoa and Objective-C so my architecture might be bogus.

Thanks again for sharing...</description>
		<content:encoded><![CDATA[<p>Thanks for the code, I have been using this sort of thing in my app after following a different thread and running into the exact same issues you address here. I did make a minor change to your code though but it may be because I am handling things improperly in my controllers. I don&#8217;t hit a URL with the arrow click I actually use it to switch out views in a context sensitive manner. For that reason your code at line 51:</p>
<p>    [[NSApp delegate] openURLInBrowser:nil];  </p>
<p>doesn&#8217;t fit my app. I changed that line to:</p>
<p>    [self performClick:nil];</p>
<p>in the subclass and then use setAction in the tableView:willDisplayCell:forTableColumn:row to point to the controller specific selector for the context. Works like a charm but may not be useful or properly designed. I am still pretty new to Cocoa and Objective-C so my architecture might be bogus.</p>
<p>Thanks again for sharing&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

