erndev/EDStarRating — Issue #1: mouseUp and mouseDragged events not called when in NSTableCellView
Author: brendand
Created: 2012-03-07 21:49:36+00:00
State: open

Hi,

Thanks for making this awesome control available. I was using Apple's NSLevelIndicator until I saw this. The level indicator doesn't let you have a different image for the different states of the stars like yours does. This is so much nicer.

So I ran into a problem with your code because I am using it within a view-based NSTableView and so have it embedded within an NSTableCellView. In this situation, the mouseUp and mouseDown events aren't called.

To solve the problem, I added this code to your mouseDown event:

if (![self.superview isKindOfClass:[NSTableCellView class]]) {
[super mouseDown:theEvent];
}

Essentially, when [super mouseDown:theEvent] is called when inside an NSTableView, the mouseUp and mouseDragged events will never be called. Adding this code solved the problem for me.

Thanks!

Brendan