Hi there. I have discovered a annoying bug of NSTableView, but I’m not very sure if its really NSTableView
/* MyView.h */
#import <Cocoa/Cocoa.h>
@interface MyView : NSView { NSTrackingRectTag trackingRect; } @end
/* MyView.m */ #import “MyView.h”
@implementation MyView
(id)initWithFrame:(NSRect)frameRect { if ((self = [super initWithFrame:frameRect]) != nil) { // Add initialization code here } return self; }
(void)awakeFromNib { [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; trackingRect = [self addTrackingRect:[self bounds] owner:self userData:nil assumeInside:NO]; }
(void)drawRect:(NSRect)rect { }
(void)mouseExited:(id)sender { NSLog(@”Mouse Exited”); }
@end
As you can see, I’m just logging the mouseEntered, mouseExited, draggingEntered and draggingExited events. The bug I’m talking about is produced when you drag a file (or various files) from a column of NSTableView (or NSOutlineView), such as Finder’s list view or column view, onto my custom view, but you have to start the drag from near the filename’s end, not from the icon. When you do that, the view receives both mouseEntered and draggingExited messages when entered and both mouseExited and draggingExited messages when exited. If you drag from the icon just draggingEntered and draggingExited are received. Really annoying.
Is anyone else experiencing the same? Does someone has a workaround for this?
Thanks a lot.
Miro Keller