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 8968171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:24:36+00:00 2026-06-15T17:24:36+00:00

I would like to individually set cell background colors in an NSForm . I

  • 0

I would like to individually set cell background colors in an NSForm. I thought it would be a matter of subclassing NSForm and overriding -drawCellAtRow:column:. But -drawCellAtRow:column: only gets called when the cell receives focus.

I’ve experimented with calling -setCellBackgroundColor on the NSForm but that changes the title background, not the value.

Is there an approach I’m not finding?

  • 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-06-15T17:24:37+00:00Added an answer on June 15, 2026 at 5:24 pm

    I think this just isn’t possible with NSFormCell.

    First thing I tried:

    self.form.drawsCellBackground = YES;
    self.form.cellBackgroundColor = [NSColor redColor];
    

    This appears to draw the background only behind the label. Some further testing suggested that a single NSFormCell spans both the label and text field, and the background was drawing behind both. When the text field draws on top, its own background covers up the red color.

    Next I subclassed NSFormCell. The only method to be called is -drawWithFrame:inView:. The frame, again, spans both the label and text field. The control view is the NSForm. If I draw my own background and then invoke [super drawWithFrame:inView:], it appears just as above, visible behind the label, but not visible behind the text field. If I invoke super and then draw the background, it appears atop both.

    NSFormCell’s implementation does not invoke -drawInteriorWithFrame:inView: nor does it seem to provide another override point.

    I tried setting highlighted, and implementing -highlightColorWithFrame:inView: – same issue.

    While I was trying to understand how this all worked I also tried subclassing NSForm. The only drawing-related method called is -drawRect:. These methods are never invoked: -drawCellAtIndex:, -drawCellAtRow:column:, -drawCell:, -drawCellInside:.

    Apart from getting Apple to fix this, the only solutions I see are trying to use NSForm’s superclass NSMatrix, or just using labels and text fields.

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

Sidebar

Related Questions

Would like to be able to set colors of headings and such, different font
I would like to check the memory consumption of each running processes individually, cat
I would like to create 10 plots that have different data, but the same
I would like to represent a datatype as a single column in my model,
Inside an Excel worksheet, I would like to protect a cell (A1) from Editing
I have a set of numbers: {2, 6, 8} I would like to check
Basic problem I have some large, but logically organised documents - and would like
I would like to have individuals config for my rails apps on my server,
I would like to be able to calculate the family relationship between two individuals
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode

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.