{"id":50,"date":"2005-06-10T08:37:58","date_gmt":"2005-06-10T15:37:58","guid":{"rendered":"http:\/\/www.corbinstreehouse.com\/blog\/?p=50"},"modified":"2005-10-04T08:40:05","modified_gmt":"2005-10-04T15:40:05","slug":"tooltips-for-nstableview-cells-in-tiger","status":"publish","type":"post","link":"https:\/\/www.corbinstreehouse.com\/blog\/2005\/06\/tooltips-for-nstableview-cells-in-tiger\/","title":{"rendered":"Tooltips for NSTableView cell&#8217;s in Tiger"},"content":{"rendered":"<p id=\"top\" \/>\n<p>At WWDC, I quickly mentioned how easy it is to add tooltip&#8217;s to an NSCell for an NSTableView\/NSOutlineView.<\/p>\n<p>Here is a quick snippet of code on how to do this only if the text doesn&#8217;t fill up the entire cell:<\/p>\n<pre>- (NSString *)tableView:(NSTableView *)tv toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc row:(int)row mouseLocation:(NSPoint)mouseLocation {\n    if ([cell isKindOfClass:[NSTextFieldCell class]]) {\n        if ([[cell attributedStringValue] size].width > rect->size.width) {\n            return [cell stringValue];\n        }\n    }\n    return nil;\n}<\/pre>\n<p>You will obviously have to set the delegate for the tableview to be whatever class implements the above method, and this will only work on Tiger. But, it is REALLY easy to do.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At WWDC, I quickly mentioned how easy it is to add tooltip&#8217;s to an NSCell for an NSTableView\/NSOutlineView. Here is a quick snippet of code on how to do this only if the text doesn&#8217;t&#8230; <a class=\"read-more\" href=\"https:\/\/www.corbinstreehouse.com\/blog\/2005\/06\/tooltips-for-nstableview-cells-in-tiger\/\">[read more]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[4,6,1],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-apple","category-cocoa","category-general"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}