• 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
Re: NSWindow, Drag and Drop, Focus Ring
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow, Drag and Drop, Focus Ring


  • Subject: Re: NSWindow, Drag and Drop, Focus Ring
  • From: "Michael Ash" <email@hidden>
  • Date: Sun, 21 May 2006 12:25:58 -0400

On 5/21/06, Sanford Selznick <email@hidden> wrote:
[snip]  Then in the drawRect in the view
I do:

- (void)drawRect:(NSRect)rect {
   [super drawRect:rect];

   if (drawFocusRing) {
     NSSetFocusRingStyle(NSFocusRingOnly);
     NSRectFill(rect);
   }
}

Seems to work well enough.

You should instead do NSRectFill([self bounds]). The rectangle passed in to drawRect: is not your view's bounds or anything else, it's just the rectangle that needs to be redrawn. If you have a subview that invalidates itself and needs to be redrawn, for example, then you'll get passed a small rectangle. The rect argument should only be used for clipping and determining if there is any drawing which can be skipped.

As it stands, it will probably work fine since you're unlikely to have
a partial invalidation during the drag operation, but better safe than
sorry.

Mike
 _______________________________________________
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

  • Prev by Date: Re: Stop NSTableColumn from being dragged, and from changing position (like iTunes)
  • Next by Date: iTunes user rating
  • Previous by thread: Re: NSWindow, Drag and Drop, Focus Ring
  • Next by thread: Currency to text
  • Index(es):
    • Date
    • Thread