Skip navigation.
 
mlGetting the correct objectValue in NSCell in NSTableView
FROM : Ferhat Ayaz
DATE : Sat Apr 19 23:04:28 2008

Hi,

I'm implementing the following method in NSActionCell's subclass which 
I'm using for NSTableColumn dataCell.


- (BOOL)trackMouse:(NSEvent*)theEvent
            inRect:(NSRect)cellFrame
            ofView:(NSView*)controlView
      untilMouseUp:(BOOL)flag
{
   NSPoint locationInCell;
       locationInCell = [theEvent locationInWindow];
       locationInCell = [controlView convertPoint:locationInCell 
fromView:nil];
   NSRect titleRect = [self titleRectForBounds:cellFrame];
   if (NSPointInRect(locationInCell, titleRect)) {
            NSLog(@"%@", [self objectValue]);
   }
   return [super trackMouse:theEvent inRect:cellFrame ofView:controlView 
untilMouseUp:flag];
}


NSLog() logs out the correct objectValue on Leopard.
Unfortunately on Tiger [self objectValue] returns the objectValue 
associated with the selected row in the NSTableView (populated by an 
NSArrayController) although I'm clicking a row which is not selected 
in the NSTableView.

How can I receive the value in the row pointed by locationInCell ?

Thanks,
Ferhat

Related mailsAuthorDate
No related mails found.