Highlighting Drag Target
Highlighting Drag Target
- Subject: Highlighting Drag Target
- From: Dennis Falling <email@hidden>
- Date: Sun, 17 Oct 2004 22:35:26 -0500
Hi all,
I'm using the following code to highlight an NSImageView subclass when files are dragged across it:
- (void)drawRect:(NSRect)rect
{
NSBezierPath *path = [NSBezierPath bezierPathWithRect:[self frame]];
if (highlighted)
{
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[path fill];
}
else
{
[path closePath];
[NSGraphicsContext restoreGraphicsState];
}
[super drawRect:rect];
}
I originally was subclassing NSView and using the same method (minus the call to super's drawRect) and it was working fine. But when I changed over to using the NSImageView, I had to add this call in to keep the image and border of the view from disappearing.
The problem I'm having is that the bezier path is being draw for everything in the frame..the border, the image, etc. How can I set it to just draw it around the inside of the border? In case I'm not being clear, here's an image of the problem I'm having: <http://www.csc.tntech.edu/~dsfallin/FasTarIssue.jpg>
Thanks,
-dennis falling _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden