Now, one idea I had was to override the mouseDown method of my NSOutlineView to do something like:

- (void)mouseDown:(NSEvent *)theEvent
{
    NSPoint     eventLocation   = [theEvent locationInWindow];
NSPoint localPoint = [self convertPoint:eventLocation fromView:nil];
    NSUInteger  modifierFlags   = [theEvent modifierFlags];
BOOL withShiftKey = ( modifierFlags & NSShiftKeyMask ) == NSShiftKeyMask; BOOL withCmdKey = ( modifierFlags & NSCommandKeyMask ) == NSCommandKeyMask;

    NSInteger   row     = [self rowAtPoint:localPoint];
    id          item    = [self itemAtRow:row];

    if ( withShiftKey || withCmdKey ) {
MyCellClass *aCell = (MyCellClass *)[self preparedCellAtColumn:0 row:row];
        NSRect cellRect = [self frameOfOutlineCellAtRow:row];

[aCell trackMouse:theEvent inRect:cellRect ofView:self untilMouseUp:YES];
    }

    [super mouseDown:theEvent];
}

Now, obviously, this isn't complete. For example, a lot more checking needs to be done to make sure if I really want to call trackMouse as I do have group rows and no special processing is needed for them.

Unfortunately, this also doesn't work as I am uncertain how to get the correct frame for the cell in the table. I am also not certain if it would even be valid to call trackMouse when obtaining the cell in this way.

If anyone has any thoughts or comments, I am interested.


On Jan 14, 2009, at 4:19 PM, Eric Gorr wrote:

I am using the pattern found in the excellent PhotoSearch sample code (http://developer.apple.com/samplecode/PhotoSearch/index.html) to do some custom mouse tracking in a custom NSTextFieldCell.

Unfortunately, if I am holding down the Cmd or Shift key when I click in a cell, the trackMouse method in my custom cell is not called.

In my custom cell, I have multiple items. These items can themselves be selected or not and I need to be able to handle the standard selection behavior normally associated with the shift & cmd keys.

Is there anything I can do about it?
_______________________________________________

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/mailist %40ericgorr.net

This email sent to mail...@ericgorr.net

_______________________________________________

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

Reply via email to