Re: How to change focus ring color?
Re: How to change focus ring color?
- Subject: Re: How to change focus ring color?
- From: Alexander Bokovikov <email@hidden>
- Date: Sun, 2 Aug 2009 03:05:02 +0600
On 02.08.2009, at 0:14, Joel Norvell <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden