• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Drawing the focus ring
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing the focus ring


  • Subject: Re: Drawing the focus ring
  • From: Sam Wilkins <email@hidden>
  • Date: Mon, 13 Jun 2005 17:17:31 -0400

On 6/13/05, Ricky Sharp <email@hidden> wrote:
> On Jun 13, 2005, at 12:19 AM, Sam Wilkins wrote:
>
> > I'm having a bit of a problem drawing the focus ring around a custom
> > view I'm writing. I'm calling setFocusRingType: with
> > NSFFocusRingExterior in my init method, and
> > setKeyboardFocusRingNeedsDisplayInRect: with [self frame] at the end
> > of my drawRect:, but I'm not having any luck. Any help would be
> > appreciated.
>
> Take a look at the ClockControl example code.  It draws the standard
> keyboard focus around a custom control (view).
>
> ___________________________________________________________
> Ricky A. Sharp         mailto:email@hidden
> Instant Interactive(tm)   http://www.instantinteractive.com
>
>

It doesn't seem to working, I should be able to tab over to the
control and then operate it with the keyboard, right? I know I didn't
modify the code.

    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];
    }

I'll try using that block of code from the sample. If I can't make it
work, I'll let you know.
 _______________________________________________
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

References: 
 >Drawing the focus ring (From: Sam Wilkins <email@hidden>)
 >Re: Drawing the focus ring (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Mouse Events on NSMatrix and NSButtonCells
  • Next by Date: Spotlight Importer for files in "Project-Based" folder
  • Previous by thread: Re: Drawing the focus ring
  • Next by thread: Re: Drawing the focus ring
  • Index(es):
    • Date
    • Thread