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

  • SEARCH
  • Home
  • 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 6000285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:40:17+00:00 2026-05-23T00:40:17+00:00

I’m working with a NSOutlineView located on a HUD panel. I configured it so

  • 0

I’m working with a NSOutlineView located on a HUD panel. I configured it so that it doesn’t draw its background. Everything looks fine until I double click to edit a cell.
The field editor draws its background and focus ring which completely ruin the whole user experience.

This is what I’m doing in the subclass of NSTextFieldCell:

- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj
{   
    NSText *text = [super setUpFieldEditorAttributes:textObj];

    [text setDrawsBackground:YES];
    [text setBackgroundColor:[NSColor darkGrayColor]];

    return text;
}

If I use setDrawsBackground:NO it’s completely ignored and I get a white background. My solution is far from being good because I can’t touch the alpha component of the color (if I do that, again the field editor will use another color as a background), but at least I don’t get a white background.

I’m wondering if there’s an actual solution to this problem. Do I have to provide my own field editor? Is it worth it?

What I want is simply a field editor with no background and no focus ring, just the cursor blinking.

Thanks!

  • 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-23T00:40:18+00:00Added an answer on May 23, 2026 at 12:40 am

    The problem is that the white background is drawn by NSTableView when it’s sent -editColumn:row:withEvent:select:. It fills the cell’s rect with +[NSColor textBackgroundColor].

    If there’s a public API for overriding the current setting for named colors from the developer colorspace, we could set it inside an override of -editColumn:row:withEvent:select: or the like. I do not recall such an API (pointers are appreciated). ALSO: I’ve only tested this code on Snow Leopard (even the Leopard SDK addendum below). Verify the code against the actual SDKs and runtime environments you intend to support.

    NSTableView has a private accessor it uses for the fill color, but it’s a read-only property. No setter, so we can’t just change the value on a standard NSTableView. We must subclass it. (Since you want the same behavior in an outlineView and NSOutlineView is already a subclass of NSTableView, we’re going to subclass NSOutlineView. But, aside from the superclass, the code is identical.)

    @interface ASCOutlineView : NSOutlineView {
    
    }
    
    @end
    
    @implementation ASCOutlineView
    
    - _textBackgroundColor
    {
        return  ([NSColor clearColor]);
    }
    
    @end
    

    seems to be all one needs to prevent that glaring white block from ruining your HUD when editing table cells in Snow Leopard.

    Apps compiled against the Leopard SDK need a little more support though. Leopard’s tableViews may have hard-coded some rendering properties so we need to override a choice method.

    NSTextFieldCells are actually wrappers for NSTextViews so they can be used inside controls. They normally share the same textView instance, which is managed by the window (or its subclass, panel, in this case). NSTableView alters the settings of the NSTextFieldCell to conform to system UI settings for editing data. Mostly. The NSTextFieldCell then propagates those settings to the NSTextView. At any point along this pipeline we can override a method or two to alter the values of those properties to match our own UI.

    I use -[NSTextFieldCell setDrawsBackground:] because it requires little effort to get correct. It’s also important to keep the internal state as consistent with the effect we’re hoping to achieve in the event some other object might depend on that state.

    @interface ASCTextFieldCell : NSTextFieldCell {
    
    }
    
    @end
    
    @implementation ASCTextFieldCell
    
    - (void)setDrawsBackground: (BOOL)flag
    {
        [super setDrawsBackground: NO];
    }
    
    @end
    

    And preventing the focus ring from appearing while the cell’s being edited is a simple matter of changing the setting of its focus ring type. Frustratingly, IB doesn’t provide access to this property, so it must be done programmatically:

    for(eachColumn in [hudOutlineView tableColumns])
    {
        columnCell = [[ASCTextFieldCell alloc] initTextCell: @""];
        [eachColumn setDataCell: columnCell];
    
        if([columnCell respondsToSelector: @selector(setFocusRingType:)] != NO)
            [(NSTextFieldCell *)columnCell setFocusRingType: NSFocusRingTypeNone];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words
I need a function that will clean a strings' special characters. I do NOT

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.