On Apr 8, 2010, at 8:17 AM, Tony P wrote: > Hi Folks, > > I'm trying to implement single-clicking for multiple words/phrases within an > NSTableView / NSTextFieldCell, which seems surprisingly tricky. I've tried > using NSAttributedString (in the hope I can use a special NSURLProtocol to > intercept the hyperlink), but it takes four clicks to get there (row select, > cell select, edit, and link-click). I've tried numerous tricks but to no > avail. > > I can over-ride hitTestForEvent (see the "Hyperlinks in Table Views" thread) > so the other alternative would be some way of getting characterIndexForPoint > for the NSTextFieldCell, but that doesn't seem to exist. I'm hoping I don't > need to do something wacky with an off-screen view. > > How can I get the NSTextFieldCell to react with just one click? Or is there a > way to get characterIndexForPoint for the NSTextFieldCell?
You'll have to implement the logic in an NSTableView subclass. Override -mouseDown:, grab the cell at the mouse location, look at the cell's contents to see if you hit a link, and if so, do your link stuff. If not, call super for the default selection/tracking/editing behavior to take place. corbin _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com