• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Highlighting Drag Target
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Highlighting Drag Target
      • From: Clark Cox <email@hidden>
  • Prev by Date: Sending Mouse Events
  • Next by Date: Hot (well, thread-safe) or not?
  • Previous by thread: Sending Mouse Events
  • Next by thread: Re: Highlighting Drag Target
  • Index(es):
    • Date
    • Thread