title: Clickable Text with Hover Effect in NSTableView
body: <p>I'm trying to create a column of clickable URL-type text (NOT URLs like <a href="http://developer.apple.com/library/mac/#qa/qa1487/_index.html" rel="nofollow">this</a>, but essentially a borderless, title button or text field cell with a tracking area for a hover effect) within an <code>NSTableView</code>. </p>
  
  <p>1.) When the user hovers over a particular cell the text in that cell should draw an underline below the text (hover/trackable area effect).  </p>
  
  <p>2.) When the user clicks the text it should perform an action. </p>
  
  <p>I've subclassed <code>NSCell</code> and <code>NSTableView</code> and added a tracking area within the custom tableview to try and track the mouse location of the individual cell of the table to notify the cell when to redraw itself. I can get the current row and column of the mouse location, but can't seem to get the right cell in my custom tableview's <code>mouseMoved:</code> method </p>
  
  <pre><code>-(void)mouseMoved:(NSEvent *)theEvent {
    [super mouseMoved:theEvent];
    NSPoint p = [self convertPoint:[theEvent locationInWindow] fromView:nil];
    long column = [self columnAtPoint:p];
    long row = [self rowAtPoint:p];
    id cell = [[self.tableColumns objectAtIndex:column] dataCellForRow:row];
  }
  </code></pre>
  
  <p>It gets the cell for the column, but doesn't get the right cell for that particular row. Perhaps I'm not fully understanding the <code>dataCellForRow:</code> function for <code>NSTableColumn</code>? </p>
  
  <p>I know you can't quite add a tracking area for cells, but instead you must create the hit test for mouse clicks and then begin tracking once the hit test is successful (meaning the mouse is already down) and then use <code>startTracking:</code>, <code>continueTracking:</code>, and <code>stopTracking:</code> to get the mouse's position. The idea though is that it has a hover effect before any <code>mouseDown:</code> action. </p>
  
  <p>Also, I can't just use a view-based tableview (which would be incredible) because my app must be 10.6 compatible.</p>