Re: Highlighting Drag Target
Re: Highlighting Drag Target
- Subject: Re: Highlighting Drag Target
- From: Daniel Todd Currie <email@hidden>
- Date: Wed, 20 Oct 2004 11:29:00 +0900
Perhaps "NSFrameRectWithWidth()" will work better?
-- DTC
On 2004 Oct 20, at 10:21, Dennis Falling wrote:
That doesn't work. You're replacing the context with the saved one
immediately after changing it.
Anybody have any ideas?
-dennis
On Oct 18, 2004, at 7:53 AM, Clark Cox wrote:
On Sun, 17 Oct 2004 22:35:26 -0500, Dennis Falling <email@hidden>
wrote:
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>
How about something more like:
- (void)drawRect:(NSRect)rect
{
if (highlighted)
{
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect:[self frame]] fill];
[NSGraphicsContext restoreGraphicsState];
}
[super drawRect:rect];
}
--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
_______________________________________________
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
_______________________________________________
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