I'm trying to get my program to recognize a double click with an NSCollectionView. I've tried following this guide: http://www.springenwerk.com/2009/12/double-click-and-nscollectionview.html but when I do it, nothing happens because the delegate in IconViewBox is null:
The h file:
@interface IconViewBox : NSBox
{
IBOutlet id delegate;
}
@end
The m file:
@implementation IconViewBox
-(void)mouseDown:(NSEvent *)theEvent {
[super mouseDown:theEvent];
// check for click count above one, which we assume means it's a double click
if([theEvent clickCount] > 1) {
NSLog(@"double click!");
if(delegate && [delegate respondsToSelector:@selector(doubleClick:)]) {
NSLog(@"Runs through here");
[delegate performSelector:@selector(doubleClick:) withObject:self];
}
}
}
The second NSLog never gets printed because delegate is null. I've connected everything in my nib files and followed the instructions. Does anyone know why or an alternate why to do this?
IconViewBox
's delegate to anIconCollectionViewItem
although it's not File's Owner because I'm trying to add it to my own project, which is set up differently than the example they have. – Woodson