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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:03:23+00:00 2026-06-05T18:03:23+00:00

I have two columns in my NSOutlineView. One is a Text and image cell

  • 0

I have two columns in my NSOutlineView. One is a Text and image cell (similar to the class in the DragNDropOutlineView Apple sample code). Next to that is a custom NSCell subclass called “XFToggleCell” that is used to display a visibility icon (eyeball) that you can toggle on and off (just like Photoshop).

The XFToggleCell supports mouse tracking/dragging (again, just like Photoshop) so you can click one eyeball, then drag down to show/hide multiple items at once. In the text and image cell, I display the text in gray when the item’s hidden, and black when it’s not.

Almost everything is working fine. When I click an eyeball (XFToggleCell), it’s image clears out and my model object becomes hidden. However, the adjacent text and image cell’s font doesn’t become gray (it doesn’t update) until I click the toggle cell again…and when I do, the coloring of the image and text cell’s text is always opposite of what it should be (when the visibility is clicked on, the text goes gray, and vice versa).

I determined that the reason this is happening is because the text and image cell is being redrawn before the value of the toggle cell is changed. As a result, its display is always “one click behind”. The sequence goes like this:

  1. I mousedown on column 1’s toggle cell.
  2. The text and image cell in column 0 is redrawn.
  3. The object value for the toggle cell in column 1 is changed.
  4. The toggle cell in column 1 is redrawn.

If I can force a redraw of the text and image cell in column 0 as step 5 above, I should be good to go.

How do I force an update to the drawing of column 0’s text and image cell as a result of clicking on column 1’s cell?

Here’s the implementation of what I think is the key method…In my XFToggleCell.m, which is in column 1:

- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
    .
    .
    .
    ...do some stuff...
    .
    .
    .
    //Here's where I change the cell's object value, causing the cell to be redrawn.
    //This part works fine.
    [self setObjectValue:([self.representedObject newState]) ? self.image : nil];
    .
    .
    .
    //Why doesn't this next line update the adjacent cell?!?!?!?!?
    //Column 0 contains the text and image cell I'm trying to update
    [controlView setNeedsDisplayInRect:[(NSOutlineView *)controlView frameOfCellAtColumn:0 row:thisRow]];
    }
    return YES;
}
  • 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-05T18:03:25+00:00Added an answer on June 5, 2026 at 6:03 pm

    Well, I’m not quite sure why, but calling

    [(NSOutlineView *)controlView setNeedsDisplayInRect:[(NSOutlineView *)controlView frameOfCellAtColumn:col row:row]];
    

    didn’t work when I put it at the end of

    -(BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
    

    in my XFToggleCell class.

    So I tried adding

    [outlineView setNeedsDisplayInRect:[outlineView frameOfCellAtColumn:col row:row]];
    

    at the end of my

    -(void) outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
    

    method in my NSOutlineView datasource and it worked. Not sure why, but this is how to do it. If anyone can shed light as to why it didn’t work calling essentially the same thing in the cell, I’d appreciate the info.

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

Sidebar

Related Questions

I have two columns, #photos and #text . My #photos column is longer and
I have two columns in a QTreeWidget , one column represents a list of
I have two columns: the left one is a Canvas containing an mx:Tree and
I have two columns in excel like the following a,apple a,bannana a,orange a,plum b,apple
I have two columns in a text file. I read them into Python into
I have a asp:GridView and in there i have two columns , in one
I have two columns in a csv file, one of which has the time
I have two columns in a table that need to be added together. One
I have two columns with two values.. I want to append some text to
I have two columns one for id & other for checkboxes. i have taken

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.