Skip navigation.
 
ml[more coherent info] Re: Focus ring around NSTextField
FROM : Scott Anguish
DATE : Sun Oct 27 23:43:10 2002

it figures that after I send the monster message, I go back and search
the Cocoa Controls example and find it right away....  I'm not having
any luck finding this example outside of the WWDC downloads though..
.:-(  Cocoa Controls Demo WWDC2K2

So, I guess you'd need to override the NSTextFieldCell, call
setShowsFirstResponder:NO, inherit, and then set it back to what it
was, and draw your own bezel.

- (void)drawClockHandsForTime:(NSCalendarDate *)theTime
withFrame:(NSRect)cellFrame inView:(NSView *)controlView {

it implements

    // If we have focus, draw a focus ring around the entire cellFrame
(inset it a little so it looks nice).
    if ([self showsFirstResponder]) {
   // showsFirstResponder is set for us by the NSControl that is drawing
us.
        NSRect focusRingFrame = clockRect;
   focusRingFrame.size.height -= 2.0;
   [NSGraphicsContext saveGraphicsState];
   NSSetFocusRingStyle(NSFocusRingOnly);
   [[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame,4,4)]
fill];
   [NSGraphicsContext restoreGraphicsState];
    }

which is called from

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlFocus ring around NSTextField Peter Schols Oct 27, 11:52
mlRe: Focus ring around NSTextField Scott Anguish Oct 27, 23:30
ml[more coherent info] Re: Focus ring around NSTextField Scott Anguish Oct 27, 23:43
mlRe: Focus ring around NSTextField m Nov 7, 11:32