On 02.08.2009, at 0:14, Joel Norvell <framewor...@yahoo.com> wrote:

If your object is always the First Responder, that would account for its focus ring always being redrawn.

As I've tested it with the code samples from your links, it's NOT the first resonder. I don't see any drawings if I surround the drawing code by if ([self showsFirstResponder]) operator.

There's a lot of good information available, but you have to look around a bit to find it.

I've checked the links. Thanks. At least I see the way now. Nevertheless my main problem is still unresolved - I can't change the color of the focus ring. I used this code:

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
        
        [super drawWithFrame:cellFrame inView:controlView];
        
//    if ([self showsFirstResponder]) {
                
// showsFirstResponder is set for us by the NSControl that is drawing us.
                
        NSRect focusRingFrame = cellFrame;
                
        focusRingFrame.size.height -= 2.0;
                
        [NSGraphicsContext saveGraphicsState];
                
        NSSetFocusRingStyle(NSFocusRingOnly);
                
                [[NSColor brownColor] setStroke];

[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame, 4,4)] stroke]; ^ ^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                //[[self focusRingPath] stroke];
        
        
        [NSGraphicsContext restoreGraphicsState];
                
//    }
        
        // other stuff might happen here
        
}

I don't see any ring if I comment the line above, marked with ^^^^^. And I see just the same blue ring, if I uncomment it. I tried NSColor set, NSColor setFill, NSBezierPath fill - all with the same result. I can't set another color. What is wrong in my code?

Thanks.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to