• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Once again: Clickable hyperlink in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Once again: Clickable hyperlink in NSTableView


  • Subject: Re: Once again: Clickable hyperlink in NSTableView
  • From: Mattias Arrelid <email@hidden>
  • Date: Wed, 6 Feb 2008 09:39:33 +0100

On 4 feb 2008, at 12.45, Johannes Fahrenkrug wrote:

Dear fellow developers,

I'm pretty new to both Cocoa programming and this list. I know the
following questing has been both asked and answered before, but I'm
still stuck.

I need to have a clickable hyperlink in one of my NSTableView columns.
I get the NSAttributedString to display nicely (blue and underlined),
but I can't click on it.
It seems as if my click never "reaches" the hyperlink.

I was - hopefully - pointed into the right direction here:

http://www.cocoabuilder.com/archive/message/cocoa/2006/3/16/158845

I tried the obove sample code in my
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)row
datasource method. Like I said: it's working as far as it's showing up
as a blue underlined string, just not clickable :(

My TableCell is of the type NSTextFieldCell.

You could subclass NSTextFieldCell, and in... trackMouse:inRect:ofView:untilMouseUp:

...retrieve the attributed string from the yourself (the cell), asking the attributed string it for it's link, and then open it using e.g.
[[NSWorkspace sharedWorkspace] openURL:anURL];


Or similar. Remember to return YES from trackMouse:... if you do handle the event yourself.

Good luck
Mattias
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Once again: Clickable hyperlink in NSTableView (From: "Johannes Fahrenkrug" <email@hidden>)

  • Prev by Date: Re: Set focus on NSView in an NSMenuItem
  • Next by Date: Re: [[NSGarbageCollector defaultCollector] isEnabled] wrong?
  • Previous by thread: Re: Once again: Clickable hyperlink in NSTableView
  • Next by thread: Checkbox state inside a function
  • Index(es):
    • Date
    • Thread