For example, the initial status is all images selected
when I clicked one, I hope it unselected, but the current status is no response for the action
Is there some settings? Thanks for any help.
For example, the initial status is all images selected
when I clicked one, I hope it unselected, but the current status is no response for the action
Is there some settings? Thanks for any help.
At last, I found the solution. add the following code in the same file of your IKImageBrowserView.
@interface IKImageBrowserView (event)
- (void)mouseDown:(NSEvent *)theEvent ;
@end
@implementation IKImageBrowserView (event)
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint pt = [self convertPoint: theEvent.locationInWindow fromView: nil];
NSInteger index = [self indexOfItemAtPoint:pt] ;
if ( index != NSNotFound )
{
NSUInteger ge ;
NSUInteger le ;
NSIndexSet* set = [self selectionIndexes] ;
NSMutableIndexSet* mutableSet = [[NSMutableIndexSet alloc] init] ;
[mutableSet addIndexes:set] ;
ge = [mutableSet indexGreaterThanOrEqualToIndex:index] ;
le = [mutableSet indexLessThanOrEqualToIndex:index] ;
if ( (ge == le) && (ge != NSNotFound) )
{
[mutableSet removeIndex:index] ;
}
else
{
[mutableSet addIndex:index] ;
}
[self setSelectionIndexes:mutableSet byExtendingSelection:NO] ;
// [ mutableSet release ];
}
}
@end