Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4058998
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:09:04+00:00 2026-05-20T15:09:04+00:00

The window’s contentView has NSTextFields. (MacOS) i’m using interface builder to setup the window

  • 0

The window’s contentView has NSTextFields. (MacOS)

i’m using interface builder to setup the window and its features, so nothing in awakeFromNib except this:

[[self.window contentView] setWantsLayer:YES];
CALayer *layer = [[self.window contentView] layer];
CGColorRef lightGray = CGColorCreateGenericGray(0.93, 1.0);
[layer setBackgroundColor:lightGray];
CGColorRelease(lightGray);

However, the textField’s focus ring is not visible outside the bounds of the textField.

With layer:

Without a layer:

i’m thinking that this display issue is something bigger than this, but i can’t find an example of this problem, (and solution).

anyone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:09:05+00:00Added an answer on May 20, 2026 at 3:09 pm

    This is a long-known issue — there’s a mention on the Cocoa-dev mailing list back in 2008. The focus ring actually gets drawn outside its view’s frame. NSView drawing is allowed to do this, but it doesn’t work with CALayers. Despite a hopeful note in the Leopard AppKit release notes called Views, Focus Rings, and Drawing Performance, this has not changed.

    In theory, it’s possible to monkey around with the text fields’ layers’ frames and add some padding to allow the focus ring to show fully. However, I’ve just tried this and it seems that, for NSTextField at least, it won’t draw neatly inside a changed frame. Give it a try, though — I didn’t fuss with it for too long. (The focus ring extends 4 pixels out from the frame in each direction.)

    Just as a note, you are technically breaking the layer-backed rules, which may be part of why you are having difficulty. From NSView setWantsLayer: docs:

    When using layer-backed views you should never interact directly with the layer.

    You’re using a layer-backed view and changing its background. You could get around this by making your own layer, but:

    When using a layer-hosting view you should not rely on the view for drawing, nor should you add subviews to the layer-hosting view.

    which rules out putting text fields in the view.

    (Refer to this SO question if needed: Difference Between Layer-Backed and Layer-Hosting Views?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using Window Home Server for my backups here at home for most
I have a WPF Window which has a among other controls hosts a Frame.
I'm using window.onback = history.forward(); to prevent users from resubmitting data. I know it's
I have a WPF window for editing database information, which is represented using an
window.location.hash When using a link for a javascript action, I usually do something like
I've a window which has custom border/caption, in order to do that I handle
The window pops up below the variable, and obscures the code I want to
From the Immediate Window in Visual Studio: > Path.Combine(@C:\x, y) C:\\x\\y > Path.Combine(@C:\x, @\y)
I have a Window where I have put a Frame. I would like to
What is the window which is displayed when you first install Eclipse called, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.