Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
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



At 12:01 AM -0700 5/21/06, I wrote:
Using draggingEntered, draggingExited, concludeDragOperation, what's
the best way to draw a focus ring just inside the edge of my window
(content area)?

Here's my solution: I moved all my drag and drop functions from my NSWindow subclass to an NSView subclass. I set up this class to be the NSWindow's content view in IB.


In draggingEntered, draggingExited, concludeDragOperation I set a state variable named 'drawFocusRing' as YES, NO, and NO, respectively and then call -display on the view. 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.

Best,
  Sanford
_______________________________________________
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




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.