Re: Hyperlink in an NSTableView
Re: Hyperlink in an NSTableView
- Subject: Re: Hyperlink in an NSTableView
- From: Greg Herlihy <email@hidden>
- Date: Thu, 16 Mar 2006 06:51:43 -0800
- Thread-topic: Hyperlink in an NSTableView
Assign the table an NSTextFieldCell as its dataCell class. For content,
create an NSMutableAttributedString initialized with HTML text that contains
a link. Lastly set the attributed string's cursor property to an arrow
cursor.
Something along the lines of:
NSString * htmlStr = @"<HTML><BODY><a href=\"http://www.apple.com\">
my link</a></BODY></HTML>";
NSData * data = [htmlStr dataUsingEncoding:NSASCIIStringEncoding];
id s = [[[NSMutableAttributedString alloc] initWithHTML:data
documentAttributes:nil] autorelease];
[s addAttribute:NSCursorAttributeName value:[NSCursor arrowCursor]
range:NSMakeRange(0, [s length])];
Greg
On 3/15/06 3:25 PM, "Marcus S. Zarra" <email@hidden> wrote:
> Is there an easy way to display a hyperlink in a NSTableView and have
> it clickable and have the mouse over behave as expected?
>
> Any tips would be greatly appreciated.
>
> Marcus
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden