Re: NSWindow, Drag and Drop, Focus Ring
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